Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Template Questions /

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Multiple Layouts

Go to End

4 Posts   4514 Views


Community Member, 1 Post

24 December 2008 at 3:43am

How do you create multiple layouts in one theme? Most sites I create have several layouts for different content types. How do we select different layouts?


Community Member, 470 Posts

25 December 2008 at 6:06am

Have you read the tutorials yet?

There is a special variable called $Layout which will rendered a specific template that matches a custom page type you have created.

You can also make multiple themes and call them per page using renderwith()


Community Member, 3 Posts

22 October 2014 at 3:14pm

Edited: 22/10/2014 3:17pm

I've read through the tutorial and quite honestly the templating setup baffling. If you create a page and controller - say 'Home' and 'HomeController' then in 'themes/mytheme/templates/' create a HomePage under 'layouts' and a layout file called 'Home' under 'templates' the layout file is not used? Instead it continues to use the default layout?

From what I've gathered the 'HomePage' if used in the cms should inherit from all 'Home' related instances but this is not the case?


I can use return $this->renderWith('Home'); from the controller but this simply loads the layout without the page content, so now I have the reverse issue. What am I doing wrong here?

I realise this is an old thread but it's the top result when looking into this. I'm attempting to use version 3.1


Community Member, 3 Posts

22 October 2014 at 3:25pm

Edited: 22/10/2014 3:27pm

Ok, for anyone else stumbling across this issue, the answer is

$this->renderWith(array('MyTemplate', 'Page'));

I still don't understand why a standard view is considered a layout. It seems the natural solution is the page 'view' references a layout.