I wanted an alternative layout for all the articles within a specific category. So I created an override file:
/tempaltes/mytemplate/html/com_content/article/myalternativelayout.php
But no way to assign this to all articles within a category automatically. The only way (I know of) doing this is to go into every single article and select the new layout file. But that is a tedious job.
I came up with this solution, but there might be a better one...
in my default.php I placed the following code and copied the original code and the alternate code into the files that I require depending on the category.
Code: Select all
if ($this->item->catid != 13):
require_once JPATH_SITE . '/templates/mytemplate/html/com_content/article/article_default.php';
else:
require_once JPATH_SITE . '/templates/mytemplate/html/com_content/article/article_myalternativelayout.php';
endif;
- Having sub-templates or layout files at our disposal, the require bit could be improved upon...
curious about other people thoughts
Remco