Joomla 2.5 alternate layouts for category

I'm a competent PHP programmer, but fairly new to Joomla and its voodoo ways.

I have a category named "tuesday-archive". I have a series of old newsletter pages, each of which is an article belonging to that category. I also have a module (type "Articles Category") which generates a list of all articles belonging to the tuesday-archive category. I have an article (call it the "list" page) which renders that module. My menu item points to the list page, which is assigned to a different category.

The overwhelming majority of these old newsletters came with their own full-page HTML, so displaying them in my site's current template is inappropriate. I need to display them in a "blank" template. I created an alternate layout by creating a very simple template file and saving it as /templates/mytemplate/html/com_content/category/news-archive.php. The content is extremely basic:

When I go the category "tuesday-archive" in the category manager, under "Basic Options", I can see news-archive as a selectable option in the Alternate Layout drop-down. It is selected, but browsing to one of the newsletter articles continues to use the full template for the site.

In my research, I've found that the alternate layout assignment at the category level will not be applied if a menu item pointing to the category exists. That is not the case here - the menu item is pointed at the list page, which is assigned to a different category. Still, if I assign the alternate layout to that menu item instead of the category, then the destination list page, and all the archived articles, will use the alternate layout as directed. This would be great, except the list page does need the normal site template.

What do I need to do to assign an alternate layout to any article belonging to a specific category, and be able to arrive there from normal menu navigation?

I have read the doc page, and the ostraining.com procedure is essentially what I did to create my alternate layout. In this case, I copied the primary site template and just removed everything. The code I posted above is literally all there was in the file. We are trying to avoid using overrides as a matter of policy.

It looks very much like I got caught up in the problem described in the irislines.com post. In this case, the alternate layout showed up and was selectable in the category manager, but it would not apply. My menu link was to an article which loads a module showing all the posts in the category - I was hoping the abstraction would make a difference. In any case, the layout will not apply unless it is also applied to the menu item, and the menu item article cannot use the alternate layout.

What I eventually ended up doing is copying the main site template again. Instead of removing everything, I inserted PHP logic to determine if the request is for the listing or a specific article. If it is the listing, the normal template is used, otherwise, the stripped template it used. I applied this alternate layout to the menu item, and it is working as desired.

<html> <head> <jdoc:include type="head" /> </head> <body> <?php /* if the URL includes 'tuesday-transit-news-archive', this is an actual news archive article. Many of them come with full-page HTML included, so they are rendered outside of the template. If 'tuesday-transit-news-archive' does not appear, this is probably the listing page, which requires the template. The template below is an exact copy of the site's default template. */ if (strpos($this->base,'tuesday-transit-news-archive')===false) { ?> <!-- the site's default template - HTML, <jdoc />, etc --> <?php } else { ?> <jdoc:include type="component" style="xhtml" /> <?php } ?> </body></html>

Featured Post

The worlds of web hosting and web development are constantly evolving. Every year we see design trends change, coding standards adapt and new frameworks/CMS created. With such a quick pace of change it’s easy to get lost trying to keep up.

A big percent of today’s marketing activity is performed through the online environment. The marketing strategies that have existed a decade ago no longer relate to what’s happening today. We’re currently facing a revolutionary era, called the digit…

There are times when I have encountered the need to decompress a response from a PHP request.
This is how it's done, but you must have control of the request and you can set the Accept-Encoding header.

Any person in technology especially those working for big companies should at least know about the basics of web accessibility. Believe it or not there are even laws in place that require businesses to provide such means for the disabled and aging p…