You can put layout files in templates/your_template/layouts. The code you can paste in your templates index.php file.
// Get menu vars for switching between layouts
$menus =& JMenu::getInstance('site'); // Full menu object
$active = $menus->getActive(); // Active id
$default = $menus->getDefault(); // Default id
$mitem = $menus->getItem($active->id); // Active menu item object
$mtree = $mitem->tree[0]; // Tree start id
$mparent = $mitem->parent; // Parent id
// Requests
$option = JRequest::getCmd('option');
$view = JRequest::getCmd('view');
$layout = JRequest::getCmd('layout');
$secid = JRequest::getCmd('secid');
$catid = JRequest::getCmd('catid');
$itemid = JRequest::getCmd('Itemid');
/*
* Check if the page requires a special layout
*/
if ($active->id == $default->id) {
/*
* Include home layout if the default ID == The active ID
*/
require( dirname( __FILE__ ).DS.'layouts'.DS.'home.php');
} else {
/*
* Include the default layout if the default ID != The active ID
*/
require( dirname( __FILE__ ).DS.'layouts'.DS.'page_default.php');
}
No comments:
Post a Comment