Layout problem


I have my SiteController like this: -


	class SiteController extends Controller {


		public function actionIndex() {






		public function actionError() {


			echo("Hello Error!");






And I also have my views layout in "views/site/main.php": -

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "">

	<html xmlns="">



			<title><?php echo CHtml::encode($this->pageTitle); ?></title>

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

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






			<div id="menu">


				<a href="#">Log in</a>




			<div id="submenu">


				<a href="#">Clients</a>




			<div id="content">


				<div id="left">


					<?php echo $content; ?>




				<div id="right">










And only the controller action is showing up but not the layout. Any ideas anyone?

to set up the layout path you need to initialize a public variable in the controller class


class MyController extends CConttroller{

 	public $layout='site/main';


there’s a lot of ways to set its path, you might want to dig into it a little deeper.

for example, if you are using modules, and you want to use a common layout that is located under application.views.layouts set the layout path this way , using double slashes

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

I’m not sure about which layout path it uses as default, so you might want to check it out on the class your controller extends from

Cheers for the reply, it works now :)