Forum for discussing general topics related to Couch.
2 posts Page 1 of 1
Hi there,

First of all, what a great CMS couch is!

On to my issue, months after launching a site, I've been asked if I can make a printable version of a certain section of the website (don't ask, I'm not sure why either).

The content in question is a food menu, (or 8 menus to be precise) which are editable from the CMS already.

Now, the simplest way I was thinking of achiving this was to make a pretty page template with the logo etc and the content mirrored from each menu using a shortcode. So for example, when they make edits on menu 1, the printable version will also be automatically edited.

I have had a bit of a search around, found some bits about masterpages but I got a bit lost. I'm possibly searching for the wrong thing... Could somebody point me in the right direction?

Thanks in advance.
Hi,

Thank for appreciating our little CMS :)

Replying to your query -
what you are trying to achieve is kind of a staple fare with Couch which does not care where you display data from any of its templates.

Allow me to explain with a little example -
Suppose you have a clonable template named 'menu.php' and it has several pages (each likely representing a menu item).

On the frontend, when one visits menu.php, you show a list of all the menu-items (i.e. data from all cloned pages of the template being visited). To do that, you'll almost certainly use a variation of the following code -
Code: Select all
<cms:pages limit='10'>
     <h2><cms:show k_page_title /></h2>
     ...
</cms:pages>

If that is clear to you, we can move to displaying the same data on a totally different template.
Suppose we want to display the same menu-items on a template named 'contact.php'.
Here is the code to do that -
Code: Select all
<cms:pages masterpage='menu.php' limit='10'>
     <h2><cms:show k_page_title /></h2>
     ...
</cms:pages>

It is the *exact* same code we used on menu.php before *except* that we are explicitly telling Couch to get the pages from a template named 'menu.php' and not from the current template that is 'about.php'. The 'masterpage' param is all that you need to show data from any template on any template.

Does this make things somewhat clearer now?
2 posts Page 1 of 1
cron