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.
There's a few ways you could do this. Here are two options:
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
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
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);