Layout Inside Layout

Hey,

I have created a custom menu-layout called “menu.php” to layouts-directory. This menu-layout will be used in every page. At the moment I’m trying to render this menu-layout inside my default controller layout(which is defined in the controller) in the following way:




<!--    

ADD MENU

   <?php $this->renderPartial('//layouts/menu', array());?>  

-->

However, it’s not rendering it. With this approach I don’t get even error messages. So my actual question is, how to render more views from layouts-directory to the same layout?

Thanks,

Ville

Well, thats the way to do it.

You dont need to have the empty array tho, but thats not whats causing the problem.

Can you post more of the code in the layout-file you are trying to render into?

Hi

u can set the in main layout in your defultcontroller


public $layout 		= 'main';

then after create the main.php in layout folder


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>


<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title><?php echo SystemConfig::getValue('site_title');?></title>

<link rel="stylesheet" type="text/css" href="<?php echo Yii::app()->request->baseUrl; ?>/css/main.css" />

<!--[if IE]><script src="js/html5.js"></script><![endif]-->

</head>


<body>

	 <section class="wapper">

             <?php //p( yii::app()->customer)  ?>

	 		<?php echo $this->renderPartial('layouts/header');?>

	 		<?php //echo $this->renderPartial('layouts/slider');?>

                        <div>&nbsp;</div>

	 		<?php echo $content;?>

         	<?php echo $this->renderPartial('layouts/footer');?>

			

     </section>

</body>

</html>






the problem is your path…

i dont know your path pattern but i m using


Yii::app()->baseurl."index.php/layouts/foo"

probably this is the ugliest way but it works:P