Going to start with a small complaint: The “nested layouts” documentation deals with . Would like to see something much simpler and encompassing more examples, certainly focusing on views.
I have a “primary” layout. Right now, it’s the layout for all the pages I will have. So just the one. I’m using a very expansive Twitter Bootstrap theme. I’ve already done the work of splitting out that main layout from the rest of the page types. However, there are several page types! Some are galleries, some are two column contents, some are image sliders. I may use two galleries, a three column page, and two sliders. Those “page types” have very little in the way of “real content” and much of the code is all css-related things like clearfix divs, etc. I would like the views to focus on the content.
So considering nested layouts, it would seem I would want to structure my layouts folder like this:
/layouts/primary.cfm
/layouts/pagetypes/gallery.cfm
/layouts/pagetypes/twoColumn.cfm
/layouts/pagetypes/threeColumn.cfm
/layouts/pagetypes/slider.cfm
Each of those files should likely have a #renderView()# in it. In my handler event code, I would expect I could say something like “setView(view=’/news/superTwoColumnPage’, layout=‘primary’, sublayout=‘pageTypes/twoColumn’)”. Clearly this is not the case. There’s no such thing.
It seems, if I can puzzle out the documentation on this feature, that I have do some sort of news HTML followed by renderLayout(layout=‘pageTypes/twoColumn’) ?
It just isn’t clear. How would the saved content get drawn. It has before and after code…so doing renderLayout(the sub layout) from the view can’t be right. Am I supposed to create my own prc variable that the layout looks for? Could someone give me a really clear explanation of what the layout files should look like (if different from normal), what the view code should be and how to get the sublayout to apply, too?
Or am I way off base and this just isn’t how it’s used? Do I have to create separate “real” layouts for every sub-layout type I might want to use? That can’t be right.