Sharing layout between modules

Hi,

I’m building and application using different modules. I found that I need to copy the layout files into the views directory for each module.

I would like to know how to use single layout file shared between all the modules.

Thanks

It’s called the application layout, and you can find it in views/layouts/main.php by default.

If you mean you need to render a module’s own layout so it looks like being inside the application layout, thus respecting the nestingness of the module, you may consider using the project “yii-modules” I just started yesterday as a starting point. It’s not stable yet, and things may change a lot, but here’s the announcing thread: http://www.yiiframework.com/forum/index.php?/topic/7839-modular-application-skeleton-on-top-of-yii/

Your controllers will only need to inherit “Controller” instead of CController, and you’ll have to call Controller::renderParents() instead of CController::render().

BUT PLEASE, please read the announcing thread carefully.