I have a problem. I have an ACL in controller LTEExecController, which goes back to SiteController, when it denies a user. But there the $layout variable points already to a view (hardcoded) with its navigation menu.
I need $layout to be changed based on the Controller that it came from.
How can I do that without being hacky? I don’t want $layout to be hardcoded. I want it to be dynamic.
simple solution would be a beforeAction in your Controller.php
public function beforeAction($action)
$this->layout = "//layouts/column1";
$this->layout = "//layouts/column3";
$this->layout = "//layouts/superLayout";
In which controller?
I have only controller LteExecController and SiteController (plus the two parent controllers). When the access gets denied through the ACL, then it will instantiate the controller SiteController. How does your code help?
I’ve tried it out. It doesn’t work.
It works I have tested it. try component/controller.php
I’ve found out why it didn’t work. It’s a bug in the Yii version 1.1.11.
I’ve updated it to 1.1.15 and it worked. What a silly coincidence that leads to two different results.