Setting the layout path

I’m busy implementing a website and I’m seperating the backend code from the front end, both sharing the same database. I followed the Yii Cookbook tutorial

Now my problem is I can’t get it to render the main.php backend layout file eg. /protected/backend/views/layouts/main.php. Instead it is still rendering the frontend layout file eg /protected/views/layouts/main.php

How can I change this? Is it possible? I followed the exact steps in the cookbook.


yes, it is possible, however unfortunately it’s a little buggy at the moment (see: )

It is #2 on the issues list so I’m pretty sure it will be fixed by the next release.

If you need the solution right away, you can find a quick fix at the link I posted above …

i hope it helps…


After reading that issue i think that the issue will only apply if one will use the CRUD to generate the application. If the OP did use the CRUD command then all he has to do is change the hard coded layout property in the Controller class.