Render other modules' layout

Hi, I’d like to render the main.php layout of another module. For example:



<?php $this->beginContent('//modules/blog/views/layouts/main'); ?>

<div id="content">

	<?php echo $content; ?>


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

Is that possible?

I would suggest to solve this using themes

and then you can specify your own layouts for modules in a theme.

To get you an idea…

Suppose you have modules module1 and module2 and you create themes theme1 and theme2

then you would need these layouts:





You can change the theme on the fly either in a module or in a controller.

class Module1Module extends CWebModule {

	public function init() {





		Yii::app()->theme = 'theme1';



class DefaultController extends Controller {

	public function actionIndex() {

 		Yii::app()->theme = 'theme1';