Yii Theme Layout

In this post, I exaplained the method for “How to set the different layout from theme”

Using yii layout concept we can change our theme layout with different styles from current theme.

The basic syntax is


“fullwidth” is layout file inside the “theme/views/layouts/” folder. It is working fine in lot of my project and also created problem in some project. The problem is, it is not getting the proper layout file path from my current theme. So i applied another method to assign the layout of my current theme.

$ThemeLayout = 'webroot.themes.'.Yii::app()->theme->name.'.views.layouts.'.$layoutname;  
if($this->getLayoutFile($ThemeLayout) !== false){
       $this->layout = $ThemeLayout

It is working fine and solved my layout problem.

Leave a Reply

Your email address will not be published. Required fields are marked *