Creating alternative layouts
Overriding views is a great way to adapt our views for every project in Joomla!. Having the capability to replace the whole markup of our view is very powerful and provides great flexibility to Joomla! site integrators. However, template overrides affect the whole site. What happens if we want to offer our projects card view and accordion view on different areas of the same site? This is when adding different item views makes sense.
Adding an alternative menu item for a component view
In Joomla!, we can define different layouts for our views in the overrides
folder. To see this, let’s move our template override to a new item type for the component.
First, create the /templates/cassiopeia/html/com_spm/projects/alternative.xml
file inside Joomla! with the following content:
<?xml version="1.0" encoding="UTF-8"?> <metadata> <layout title="COM_SPM_VIEW_PROJECTS_ALTERNATIVE &...