F
F
fredrsf2014-03-23 22:54:55
Yii
fredrsf, 2014-03-23 22:54:55

How to change controller layout in Yii?

There is a module that uses one theme. The module has a controller for which you need to connect another theme. For this I do

public function init(){
        Yii::app()->theme = 'buble';
        $this->layout = 'buble_main';
        parent::init();
    }

The theme changes, that is, the view for the controller is taken from the 'buble' theme folder, but layuot is not loaded, not at all. How to load the required layout for this controller?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dialog, 2014-03-24
@fredrsf

You don’t need to do this in the Internet, it’s enough to specify the property value in the controller class:
If it doesn’t work, then do the same in a specific action + as an option to debug if the layout has changed, it might be worth specifying the full path to it (for example //layouts/buble_main ).

F
fredrsf, 2014-03-24
@fredrsf

In the controller, as a property, it didn’t help, but right in the action, yes. Thanks

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question