Problems, need help? Have a tip or advice? Post it here.
7 posts Page 1 of 1
hello ... in the past I've implemented something similar to the solution in the following post to allow the client to have a central list of reviews (each a cloned page) which are then selectable using a dropdown in a repeatable region across different pages in the site.
http://www.couchcms.com/forum/viewtopic.php?f=4&t=8032&p=15209&hilit=dropdown+cloned+pages#p15209

It works a treat and allows them a level of flexibility which they like!

I wanted to do something similar on a new site but with an extra level of granularity. I want to set up testimonials as cloned pages and allow them to be selected via a dropdown list in a repeatable region. BUT I would also like to categorise the testimonials so that on different pages within the site the dropdown list is filtered to those testimonials relevant to that page. So on the Weddings page they only get a list of wedding related testimonials and on the Food & Drink page only those relevant to that etc etc A single testimonial may fall into more than one category e.g. Weddings and Food & Drink.

My plan is to add a checkbox editable field (testimonial_category) to the testimonials.php clonable template holding all the different categories. Then, for example, on the Weddings page I would want to code "is the checkbox ticked for weddings for this cloned page?"

Code: Select all
Please Select=-
<cms:pages masterpage='testimonials.php' custom_field='testimonial_category==weddings'>
   | <cms:show k_page_title  />=<cms:show k_page_id  />
</cms:pages>


I know the above won't work as testimonial_category is an array of values in a checkbox editable field. This is all at the planning stage right now so I haven't been able to experiment.

Is this do-able? Thanks in advance!
Hi potato,

Seems straightforward enough to me.

I suggest, however, that you use 'relations' instead of 'checkbox'.

With cms:pages now supporting relations in 'custom_field' parameter (please see 'Enhanced cms:pages tag' - viewtopic.php?f=5&t=8581), the syntax will almost be what you have quoted
<cms:pages masterpage='testimonials.php' custom_field='testimonial_category=weddings'>
..
</cms:pages>

Hope this helps.
hi KK - many thanks - looks like a great solution, I'll give it a go.
Thank you that worked! Just wondering if it's possible to check for a phrase ...

<cms:pages masterpage='testimonials.php' custom_field='testimonial_category=business meeting'>

I've tried a few things without success.
Searching for values in the related template is, I am afraid, not (yet) possible, @potato.
thanks KK ... does it make any difference that the field I want to test is actually the name of the relationship?
Code: Select all
<cms:editable 
    name='testimonial_category'
    label='Testimonial category'
    desc='choose all relevant categories'
    type='relation'
    masterpage='testimonial_category.php'
    orderby='page_title'
    order_dir='asc'
    order='15'
/>
does it make any difference that the field I want to test is actually the name of the relationship?
The only valid values a 'relationship' field will accept are the 'name' of the related pages e.g. the following will show pages related to pages named 'business-meeting' or 'leisure'.
<cms:pages masterpage='testimonials.php' custom_field='testimonial_category=business-meeting, leisure'>
And that is about all we can specify using the relation fields.

Anyway, can you please give some more details of what you are trying to achieve? Perhaps we are looking at the wrong solution after all.

Thanks.
7 posts Page 1 of 1