Problems, need help? Have a tip or advice? Post it here.
6 posts Page 1 of 1
Let's say I am creating a slider on my home page, that draws the visitors attention to various pages on my site.

So, each slide will have the following information :

1) Image
2) Title, e.g. "Summer Deals"
3) Description, e.g. "We have some great offers in July and August!"
4) Read More URL, e.g. 'summer-deals.php'

The first three are easy enough in Couch. Number four could just be a simple text field, but I'd like to give the client a way of selecting an existing Couch page from a dropdown menu.

So, is there a way of getting every Couch page (and it's url) into a select menu?

Code: Select all
<cms:editable 
  name="slide_url"
  label="Slide URL"
  desc="Select which page this slide should link to"
  opt_values='[GET ALL PAGES][PAGE NAME]=[PAGE URL] | [/ GET ALL PAGES]'
  type='dropdown'
/>


It's the [GET ALL PAGES] bit I need help with ...

Cheers :)

PS. I'm not currently using Nested Pages.
Hi,

Please take a look at viewtopic.php?f=2&t=3682
where an undocumented feature of Couch ('dynamic' parameter) is discussed in my reply to the original question.

Do let me know if you require any help with the technique.

Additionally, if you can use Couch v1.3RC1, the 'relationships' feature (http://www.couchcms.com/docs/concepts/r ... ships.html) can also be used for the purpose. You can easily create a 'Many-to-One' relation (shows a dropdown) that'll show a list of all the pages to choose from.

Hope this helps.

Thanks
Thanks for the reply.

The first suggestion (using dynamic) is a very cool feature, but from what I gather this would only be of use if I were creating my pages from a single template (which I'm not).

The second suggestion could do the trick. I am using 1.3 so I'll give it a go...

Thanks for your help!
I think both of these solutions assume that I am creating pages from a template. In my site, there is no template, and no masterpage. I create each page manually in Couch, but I'm not sure how to get a list of all pages.
In my site, there is no template, and no masterpage. I create each page manually in Couch

I assume what you mean is that there are no 'clonable' templates. Every template that you add to Couch (by adding '<?php require_once( 'couch/cms.php' ); ?>' etc) and that appears in the sidebar, is a template (though you might not be cloning additional pages out of them).

Try using the 'templates' tag (http://www.couchcms.com/docs/tags-refer ... tes-1.html) with the 'dynamic' parameter.
Do let me know if this helps.
Thanks for your help. This is how I finally managed to get a list of Couch pages into a SELECT dropdown menu.

Code: Select all
<cms:editable 
      name="page_url"
      label="Choose page"
      opt_values='list_pages.html'
      dynamic='opt_values'
      type='dropdown'
      val_separator='~'
   />

Code: Select all
/* snippets/list_pages.html */

<cms:templates show_hidden='1' orderby='title' order='asc'>
  <cms:show k_template_title />~<cms:show k_template_link /> |
  <cms:if k_template_is_clonable>
    <cms:pages masterpage="<cms:show k_template_name />">
      &nbsp;<cms:show k_page_title  />~<cms:show k_page_link  /> |
    </cms:pages>
  </cms:if>
</cms:templates>


You have to love Couch for stuff like this :)
6 posts Page 1 of 1
cron