Different UI layout for different levels of users in yii
I am new to Yii. I am developing a system with YII framework in PHP. How can I have a different layout for another module? I want module A to have interface A, module B with interface B. But what I know is that entering the interface is the same for entering all modules. Can anyone give me some light?
Update:
I found one way which should include:
$this->layout = $layout;
for the action function inside the controller before rendering the page. However, I have found that this is not as efficient as with every action I need to repeat. Is there a way we can do the customization in the config / main.php page? probably from this side:
'modules'=>array(
'gii'=>array(
'class'=>'system.gii.GiiModule',
'password'=>'123',
'generatorPaths' => array('bootstrap.gii'),
),
'admin',
'consultant',
'client',
),
source to share
You can set variables for your module config
like this:
'modules'=>array(
'gii'=>array(
'class'=>'system.gii.GiiModule',
'password'=>'123',
'generatorPaths' => array('bootstrap.gii'),
),
'admin' => array(
'layout' => 'your_layout' //The layout for this module
),
'consultant',
'client',
),
This way you can implement a default layout for each individual module. No need to add methods and variables controller
.
source to share