Alternative layout for article based on category in Joomla 2.5

泪湿孤枕 提交于 2019-12-06 01:33:25

Well thats a good question. Maybe you could make your default layout some kind of a switch: Put the regular layout in something like regular.php and the special in like special.php and have the default.php discover which category the article belongs to. Then include the code of the respective layout file... Just an idea.

Like this...

default.php:

<?php 
   ...
   $specialCategory = 42; // the id of your special category
   if($this->item->catid == $specialCategory){
       include "special.php";
   }else{
       include "regular.php";
   }
?>

Please note that I did not try so far...

Edit: I just found this in the com_users login view:

default.php

if ($this->user->get('guest')):
// The user is not logged in.
echo $this->loadTemplate('login');
else:
// The user is already logged in.
echo $this->loadTemplate('logout');
endif;

The files in the tmp folder are named default.php, default_login.php and default_logout.php.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!