Problems, need help? Have a tip or advice? Post it here.
2 posts Page 1 of 1
First, KK, couch is frickin' awesome. As a front end guy, to be able to do PHP type stuff without having to get all PHP-y, is just incredible. It took me a couple of days to get over the learning curve, but now I'm spitting out <cms:pages like it's nothing. So a big THANK YOU.

Now on to the question. I'm trying to wrap my head around the Nested Pages philosophy, and for the most part I get it. But I have hit some roadblocks.

In a lot of CMS's, you create a new page in the CMS, and then you select the 'page template' that you want to use for that page.

In Couch, if I'm using nested pages, then that new page is going to inherit the root page's template, usually index.php. I hope I'm correct so far.

But if you want it to use a different template, you have to first create that new template and then create a pointer to it inside of your 'Nested Pages' tree.

But what does a client do if they want to make a new page called "Beliefs" based off, say, a two column layout? Obviously they wouldn't create a new HTML template... I'm obviously missing something as far as how an entire site comes together. I did the full tutorial, but am still not understanding the Nested Pages set up for a situation like this.

Any help would be greatly appreciated.
Hello and welcome, Chris :)

Thank you for letting us know your thoughts on Couch. I am glad you liked it :)

Replying to your query -
the 'raison d'etre' for nested-pages is mainly creation of dynamic menus (the 'pointers' help with this).

One can use a single nested-pages template, theoretically, to structure a complete site but, as you observed, this will work out of the box only when all the pages share the same template structure (i.e. the same editable regions). If not, we have to use other templates to define the required editable regions and then make the nested-pages point/masquerade those templates.

The point to note above is 'sharing the same editable regions'.

Many of the CMSs that allow "to create a new page in the CMS, and then you select the 'page template' that you want to use for that page" actually, by default, give you a fixed number of editable regions (e.g. title, content etc.) which are used in all templates.
This makes it trivial to select templates dynamically.

If, for example, you also have a fixed number of editable regions used across all pages, it'd be very easy to create the 'select layout' function. Let me explain -

Define an editable region like this to allow users select the desired layout -
Code: Select all
<cms:editable 
    name='my_layout'
    label='Select layout for page'
    opt_values='No Sidebars | Left Sidebar | Right Sidebar'
    opt_selected = 'Left Sidebar'
    type='dropdown'
/>

Now, in the template, use the following statements to display pages using the selected layouts -
Code: Select all
<cms:if my_layout='Left Sidebar'>
    .. put HTML here directly or via cms:embed ..
</cms:if>

<cms:if my_layout='Right Sidebar'>
    .. put HTML here directly or via cms:embed ..
</cms:if>

<cms:if my_layout='No Sidebars'>
    .. put HTML here directly or via cms:embed ..
</cms:if>

Hope this helps.
2 posts Page 1 of 1