2

Within mytemplate, I created an alternative menu and an alternative layout for the com_content articles view, and neither reflects on the front end.

For com_content, in my template, I created the following files:

joomla/templates/mytemplate/html/com_content/article/LandingPage.php
joomla/templates/mytemplate/html/com_content/article/LandingPage.xml
joomla/templates/mytemplate/html/com_content/article/LandingPageLayout.php

At the top of file LandingPage.xml, the layout section contains:

<layout 
        title="TPL_MYTEMPLATE_COM_CONTENT_ARTICLE_VIEW_LANDINGPAGE_TITLE" 
        option="TPL_MYTEMPLATE_COM_CONTENT_ARTICLE_VIEW_LANDINGPAGE_OPTION">
    <help
        key = "JHELP_MENUS_MENU_ITEM_ARTICLE_SINGLE_ARTICLE"
    />
    <message>
        <![CDATA[TPL_MYTEMPLATE_COM_CONTENT_ARTICLE_VIEW_LANDINGPAGE_DESC]]>
    </message>
</layout>

Through backend, I can select the alternative menu type, but when I load the web page corresponding to menu item, the HTML corresponds to

/components/com_content/article/view/default.php

I have re-read the documentation for alternative layouts and alternative menu items and rechecked I am following instructions correctly: https://docs.joomla.org/Layout_Overrides_in_Joomla

Also, I looked for duplicate answers, and found:

Layout Override shows up as menu Item but not as category layout

Can't see alternative layout once i add xml file

I believe I understand the logic for the mytemplate alternative menu items and alternative layouts, but I can't figure out what I am doing wrong.

The URL's generated through the back end for the menu items set to this alternative menu type item have the following syntax:

index.php?option=com_content&view=article&layout=mytemplate:LandingPage&id=1

Looking for alternative solutions, I then set the LandingPageLayout.php through the article's configuration Options Layout setting. The article's Options > Layout drop-down shows the alternative layout "LandingPageLayout." However, through the front end, the menu item continues to display the code from /components/com_content/article/view/default.php

To easily differentiate which php file is loading, from among default.php, LandingPage.php, and LandingPageLayout.php, I entered an HTML tag that clearly shows me which file is loading.

What am I doing wrong?

Why is the content from mytemplate article's alternative menu item and alternative layout not loading trough the front?

1 Answer 1

1

I know this is a really old post, but I ran across it trying to solve the same issue in Joomla 4.

The simple solution was to change the case. The template filename need to be in all lowercase: joomla/templates/mytemplate/html/com_content/article/landingpage.php joomla/templates/mytemplate/html/com_content/article/landingpage.xml joomla/templates/mytemplate/html/com_content/article/landingpage_layout.php

1
  • Well done, Scott. Thank you for contributing some modern advice. This is precisely what Joomla users should be doing when they find unresolved questions on this site. Please take our tour and consider telling us a bit about your Joomla experience by editing your profile Commented Apr 22, 2023 at 1:13

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.