3

I am a bit of a Joomla noob, so forgive the question, but I have searched for an answer.

I am looking to customize the layout of the featured articles component. However, I do not want to customize the layout for ALL instances of the featured articles, just how it is shown for one page as an example. I understand how this works for modules but not for components.

I have looked at this link which details how to make a component override well: https://www.joomlashack.com/blog/joomla-templates/1067-customize-your-joomla-templates-by-learning-overrides

Once I have my override, how do I apply that to only one occurrence. As an example, lets say I have two menu items which our Featured Articles, but linked to different categories. I would like one of the menu items to use one layout and the other to use the custom one. Do I need to setup multiple templates for this, even though the base template is the same, its just the override that is different?

2
  • I believe you're looking for a Layout Override which once done, can be selected when editing an article, under the Options tab
    – Lodder
    Commented Feb 26, 2015 at 19:41
  • But it's for a menu item not a specific article. A bunch of featured articles layed out on a page
    – StuartM
    Commented Feb 26, 2015 at 19:59

1 Answer 1

4

Layout Overrides » Alternative Menu Items

From your question I understand that what will fit your needs is to create an alternative menu item for the Featured Items menu item.

This is almost identical to the common overrides with the exception that you will give a new name to your layout file and also create a XML file with the same name.

So, copy the Featured items layout files to the html folder of your template and also copy its XML file.

Rename them to something like "myspecialfeatured.php" and "myspecialfeatured.xml". Also copy the rest of layout files and rename them accordingly with the your given name and the underscore _links.php & _item.php.

Also, you need to open the XML file and edit the few first lines, to change the name and description.

Change the lines below in the beginning of the XML, give them your menu item's name.

<layout title="COM_CONTENT_FEATURED_VIEW_DEFAULT_TITLE"
  option="COM_CONTENT_FEATURED_VIEW_DEFAULT_OPTION">
 <help key = "JHELP_MENUS_MENU_ITEM_ARTICLE_FEATURED" />
 <message>
  <![CDATA[COM_CONTENT_CATEGORY_VIEW_FEATURED_DESC]]>
 </message>
</layout>


<layout title="myFeatured"
  option="my Featured Items">
 <help key = "JHELP_MENUS_MENU_ITEM_ARTICLE_FEATURED" />
 <message>
  <![CDATA[my Featured Items]]>
 </message>
</layout>

You can now choose your alternative featured articles menu item type, for any menu item you want.

As a further tip, you can change also what parameters you want this menu item to have, by tweaking the xml file.

For further help you can read the documentation at joomla.org - scroll down to the alternative menu items.
Layout Overrides in Joomla

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.