Layout overrides - gobezu/k2fields GitHub Wiki

In k2fields you can create overrides of templates with specificity down to an item by applying the following naming conventions. In addition as you will see below you can include item or category specific stylesheets by including them in any of the override folders.

View Specificity\Templates Category* Item Field** CSS file
itemlist Item category_view_item_i[itemid].php category_view_fields_i[itemid].fld i[itemid].php
itemlist Category category_view_c[categoryid].php category_view_item_c[categoryid].php category_view_fields_c[categoryid].fld c[categoryid].php
itemlist Generic category_view.php category_view_item.php category_view_fields.fld
item Item item_view_i[itemid].php item_view_fields_i[itemid].fld i[itemid].php
item Category item_view_c[categoryid].php item_view_fields_c[categoryid].fld c[categoryid].php
item Generic item_view.php item_view_fields.fld

[*] In case of subtemplates as in case of category templates that call item templates we try to find the best available ones by going from the most specific ones. Ex. if we have a category specific template defined for category with ID 20 in the file category_view_c20.php the subtemplates can be either of the followings with the named order to be picked:

  • category_view_c20_item_i[itemid].php
  • category_view_c20_item_c[catid].php (where [catid] is 20)
  • category_view_c20_item.php
  • category_view_item_i[itemid].php
  • category_view_item_c[catid].php (where [catid] is 20)
  • category_view_item.php

[**] Read the following wiki for more on how such templates should be written https://github.com/gobezu/k2fields/wiki/Field-rendering

Layout overrides

Make sure that the k2fields plugin setting Item/category specific Layout is turned on.

Layout overrides are looked for in your current theme folder.

Specific stylesheets

Make sure that the k2fields plugin setting Item/category specific CSS is turned on.

CSS files are looked for in the following folders in named order:

  • templates//html/com_k2fields/,
  • templates/'.$tmpl.'/html/com_k2fields/templates/,
  • components/com_k2fields/templates/,
  • templates/'.$tmpl.'/html/com_k2/,
  • templates/'.$tmpl.'/html/com_k2/templates/,
  • components/com_k2/templates/
⚠️ **GitHub.com Fallback** ⚠️