multiple layouts or multiple themes?

Hello!

I’d like to make a different style and structure for my FAQ and help site for my website. So it would look like pretty different then the rest of my website. I was looking for a solution and found 2 ways.

  1. multiple layouts

  2. multiple themes

I’ve tried to generate multiple layouts but when I try to render it without the layout of the rest of the website it doesn’t work (renderPartial(), when I use render() the view with the different layout is shown in the “original” version of the layout, looks a bit funny ;) ). So I thought using different themes. But before I start trying to implement it I thought it would be good when I ask which solution would be the best one. Do I have make a mistake or is it not possible to render a view completely with a different layout.

Thanks for any tip and help :)

Greetings, capo

No one has a tip or idea? Can anybody say for which scenarios multiple themes are the best solution and for which scenarios multiple layouts are the best solution?

Layouts are more for variations on your current theme, such as a 2-column layout, fixed-width, variable-width, one central column. All these are layouts of the same theme, just variations.

A whole new theme is an entirely separate look and feel in comparison to other themes, which is what I think you’re looking for.

I’m not quite sure I understand the problem you’re describing with the rendering issues, but below is a quick snippet on how to change layouts.

If you want a separate layout for the entire controller, do


class MyController extends Controller {

public $layout = '//layouts/my-layout';



Otherwise, if you’re in an action




public function actionMyAction() {

$this->layout = '//layouts/my-layout';

}



Hope that helps

Tank you for the answer.

I think you are right that a new theme is what I’m looking for. That could be the reason why changing the layout doesn’t work the way I want.

Greetings, capo

‘themeManager’ => array(

'class' => 'vendor.schmunk42.multi-theme.EMultiThemeManager',


'rules' => array(


    '^p3(.*)'                   => 'backend',  // use backend theme for all routes starting with p3


    '^user/default/index'       => 'frontend', // use frontend theme for several routes of the user module


    '^user/login/(.*)'          => 'frontend',


    '^user/profile/(.*)'        => 'frontend',


    '^user/registration/(.*)'   => 'frontend',


    '^user/recovery/(.*)'       => 'frontend',


    '^user/activation/(.*)'     => 'frontend',


    '^user/(.*)'                => 'backend',  // use backend theme for user module


    '^rights/(.*)'              => 'backend',  // use backend theme for rights module


)

),