Problems, need help? Have a tip or advice? Post it here.
2 posts Page 1 of 1
I was idly browsing through the list of Couch tags - some of which I don't know yet ... and came across the page_exists tag. An example is given as follows:
<cms:page_exists 'contact-us' masterpage='index.php' />

The above snippet is checking for the existence of a page named 'contact-us' that has been cloned out of a template named 'index.php'.

I can't make full sense of this - so am wondering if you could explain KK. I understood clones to be pages of a blog say, so we can create a list view of blog entries and clones of blog for all the single page views. In your example it seems that a single page, Contact Us has been cloned out of another single page, Index/Home page. Or is this an example where sub-navigation / nested pages have been assumed? I'm just wondering if there is a big gap in my understanding and use of cloned pages here?!
Hi Potato,

Your understanding about the cloned pages is perfectly alright. I think the name of the page ('contact-us') in the example threw you off a little.

A site usually has two kinds of pages -
1. Those that can be grouped together like blog, news, products etc.
2. Stand alone pages e.g. about-us, contact-us, policy etc.

In Couch we create the first kind of pages by using a single template (e.g. blog.php) and then cloning it to create the whole bunch of pages within the group.

The second (stand-alone) pages usually have a discrete template for each page.
However, if the stand-alone pages have the same or similar editable regions (e.g. the about-us, contact-us, policy will all usually have only a 'content' richtext region), we can create them using a single template and then cloning it to create the individual pages.
This cloned template can be 'index.php' in which case we get the addition benefit of nice looking URLs e.g.
http://www.example.com/about-us.html
http://www.example.com/contact-us.html
This is the approach we take for creating nested-pages, remember?

As I said, it was the name of the page in the example that confused you. The same code could be put as
<cms:page_exists 'my-first-post' masterpage='blog.php' />

and I'm sure this would have made perfect sense :)
2 posts Page 1 of 1