How Can I Create New Main Layout

Dear all,

I want to create new main layout and I work for this but it can not show the content in the main layout.

I have new components/UserControler:


class UserController extends CController


	public $layout='//layouts/usercolumn'; 


	public $menu=array();


	public $breadcrumbs=array();


new layouts/usercomlumn :

<?php /* @var $this Controller */ ?>

<?php $this->beginContent('//layouts/usermain'); ?>

<div id="content">

	<?php echo $content; ?>

</div><!-- content -->

<?php $this->endContent(); ?>

new layouts/usermain:


	<div id="header">



	<div id="mainmenu">

		<?php $this->widget('zii.widgets.CMenu',array(


				array('label'=>'Home', 'url'=>array('/site/index')),

				array('label'=>'About Us', 'url'=>array('/categories/index')),

				array('label'=>'Galary', 'url'=>array('/services/index')),

				array('label'=>'Contact', 'url'=>array('/admin/index')),				


		)); ?>



	<?php if(isset($this->breadcrumbs)):?>

		<?php $this->widget('zii.widgets.CBreadcrumbs', array(


		)); ?><!-- breadcrumbs -->

	<?php endif?>

	<?php echo $content; ?>


controllers/HomeController :


class HomeController extends UserController


	public $defaultAction = 'home';


	public function actionHome()


		$this->layout = 'home';




it can not show the menu in usermian page, it just shows the content in home page.

thankyou very much


In your home controller why are you using this line…

$this->layout = ‘home’; // this line does’t make any sense for me :(

I dont think you have home layout in your application…

u should set your layout name like this

$this->layout = ‘usercomlumn’;

or dont assign layout… it will take your default layout from your parent controller

:) cheers

use this

$this->layout  =  '//layouts/home';

instead of $this->layout = ‘home’ and you must ensure that home is available on the views/layouts otherwise It makes the problem

I remove $this->layout = ‘//layouts/home’; and it works for me,thankyou very much