Joomla: Alternate category layouts
We were searching in Joomla content category layouts similar to K2 category templates. Since Joomla 1.6 this is possible.
In K2 it’s quite simple, you just set clone and rename the default template and assign it to category. In Joomla content the system is harder to set but it’s more powerful since you can override also category parameters and translation strings.
The information for this article was extrated from Joomla Docs: Layout overrides in Joomla 1.6
There are two ways to override a category template:
1. Categories not linked in menus.
This is the basic override and works as the K2 category template. In your template you have to clone and rename the blog category files. In:
templates/YOURTEMPLATE/html/com_content/category
copy and rename the files:
blog.php, blog_children.php, blog_item.php and blog_links.php
for example if you want a category template called “product” rename the files to:
product.php, product_children.php, product_item.php, product_links.php
The final folder appearence will look like:
Now in the category edit form you will see an alternate layout available:
It’s done. Now you can adjust the templates to your needs.
2. Category linked in menu
Category overrides through menu links allow you an advanced override system. The method it’s the same used in the case 1 plus add a layout XML file. This will give us full control to customize the layout.
Follow the steps of case 1 and also copy the file:
components/com_content/views/category/tmpl/blog.xml
to:
templates/YOURTEMPLATE/html/com_content/category/product.xml
The final folder status:
Now you only have to customize the XML layout to give it the name, translations, etc. (read the Joomla docs for more info)
You will have a new menu type that you can select to make a new menu item:
Parametrize it to your needs and you are done!!
Hope this helps
Deja un comentario