Answer the question
In order to leave comments, you need to log in
How can I switch from one subpattern to another in different modules?
Good afternoon,
I want to have several subtemplates in the created admin module. Created so far 4 - Default column1 and column2 and duplicated them column1-admin and column2-admin
class AdminModule extends CWebModule
{
public function init()
{
$this->layout = '/layouts/main';
}
}
class DefaultController extends Controller
{
public function actionIndex()
{
$this->layout = '//layouts/column1';
$this->render('index');
}
public function actionView()
{
$this->layout = '//layouts/column2';
$this->render('index');
}
}
<?php $this->beginContent('//layouts/main'); ?>
<div id="content">
column1
<?php echo $content; ?>
</div><!-- content -->
<?php $this->endContent(); ?>
<?php $this->beginContent('//layouts/main'); ?>
<div class="span-19">
<div id="content">
column2
<?php echo $content; ?>
</div><!-- content -->
</div>
<div class="span-5 last">
<div id="sidebar">
<?php
$this->beginWidget('zii.widgets.CPortlet', array(
'title'=>'Operations',
));
$this->widget('zii.widgets.CMenu', array(
'items'=>$this->menu,
'htmlOptions'=>array('class'=>'operations'),
));
$this->endWidget();
?>
</div><!-- sidebar -->
</div>
<?php $this->endContent(); ?>
$this->layoutPath = Yii::getPathOfAlias('admin.views.layouts');
$this->layout = 'main';
$this->layout = 'admin.views.layouts.main.column1';
// public $layout = '//layouts/column1';
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question