How to assign a different Joomla template style to subpages?

by Taimur Aziz   Last Updated July 16, 2017 15:10 PM

How to make the sub articles have different template style and not inherit the one assigned to their parent category?

Let's say that I have news category which uses the default template style. How can I assign a different template style the single articles of that category.

Thanks



Answers 2


There's a few ways you could do this. Here are two options:

Option 1:

Using a category blog.

If we use the news example, do you require the parent category to be a list view (which uses a different template, and listing each article in it's view), with a separate layout view for each article?

To customise the default layout for a category blog in Joomla, you need to create an override for com_content/category (navigate to Extensions -> Templates and overrides from there).

See this post for more info on multiple blog styles: https://stackoverflow.com/questions/22177277/joomla-3-x-category-blog-override-is-it-possible-to-have-more-than-one

Option 2:

Use Joomla's template styles.

Set these up by assigning Joomla's template styles to a menu item (pointing to your category of choice) and editing your template view in your theme accordingly.

Here's a page from the Joomla docs for reference: https://docs.joomla.org/Help37:Extensions_Template_Manager_Styles

sigil
sigil
July 16, 2017 17:51 PM

If your template is not in the list of the non-compatible templates/frameworks of this extension, I would suggest you to go with the Regular Labs Advanced Template Manager.

Advanced Template Manager is an extension that changes the way your Template manager works.

With Joomla you can normally only assign template styles to certain menu items.

With Advanced Template Manager you have the possibility to assign template styles to just about anything you want, giving you full control over your Joomla template styles.

Some of its Assignment Options:

Menu Items, Home Page, Date Range, Templates, URLs, Devices (Mobile, Tablet, Desktop), Operating Systems, Browsers, Components, Tags, Joomla! Content (Assign templates by Joomla Page types, Categories and Articles) and more...


In case you want to go the customization way (e.g. overrides, or with a system plugin) you can programmatically assign a template with the following code:

$app = JFactory::getApplication();
$params = array();
$app->setTemplate($template_name, $params);
FFrewin
FFrewin
July 16, 2017 21:21 PM

Related Questions




Convert 1.5 template to 3.x

Updated February 23, 2017 00:10 AM

where to get templates like this?

Updated June 28, 2015 15:04 PM