Wiki

Change and overwrite column layout with PHP in JYAML4x

If you need a certain column layout on a special case you can do this with a few lines of PHP code.

/**
 * Example to force 1 column layout on a special condition 
 * (You can add this code, e.g. at top of the file /html/index/default.php)
 */
 
if( JRequest::getVar('option') == 'com_myspecial' ) // a condition you want
{
 $layout = '1col_3';
 $this->set('_active_layout', $layout); // set Layout
 $this->setPositionCount('col1_content', 0); // disable col1 for countModules
 $this->setPositionCount('col2_content', 0); // disable col2 for countModules
 $this->addBodyCssClass('layout', $layout); // change the body class
}