I have a project where the user chooses the layout, and saves it in the database, how do I choose to change this layout in real time?
For example; http://www.example.com/username/controller/action/id
Throughout the site I would have with the first parameter the username, which is actually where the system will know which layout it chose.
Can anybody help me?
EDITED
For example; When the user accesses the site I pass the following link: www.example.com/index.php?layout=4545455, so I would be able to know which layout to use, but how do I keep this parameter layout=4545455 on all routes Site? Well if I click on the about menu it will be with the url www.example.com/index.php?r=site/about
You can set layout inside your login controller. When user log-in successfully, get his layout from database and set the layout as
$this->layout = "layout_name". Provided that you need to keep layout files ready inside your view folderNote : Please refer @sm1979's answer for more detail