Problems, need help? Have a tip or advice? Post it here.
4 posts Page 1 of 1
Hi guys!

I'm trying to figure out how to do this "the right" way, but I struggle a bit.. !

I have a cloned page template called experiences.php which list x number of entries, on each entry there is some basic info about the experience but in some cases - not all, I want to show a link/exerpt from a related event.php page

They way I did it so far, which doesn't really work is to create a edible field in experiences.php where I fill in the ID of the related event as so:
Code: Select all
<cms:editable name='linked_event' label='Event Linked' type='text' width='30' />


and then I run the pages loop as such:
Code: Select all
<cms:if linked_event>
<cms:pages masterpage='events.php' orderby='page_name' order='asc' id='<cms:show linked_event />' >
<cms:show main_text /><br><cms:show event_location />
</cms:pages>
</cms:if>


That doesn't work, and I assume that's due to the linked_event varible is not located in events.php, but in the page it self? If i manully put the ID of the page in the page loop it works fine..

Special thanks to KK for this amazing piece of art..! Much appreciated! Happy Friday peeps :D
Hi @tobbs :)

Please try using double-quotes (instead of the single-quotes that you have now) with the parameter highlighted below -
<cms:pages masterpage='events.php' orderby='page_name' order='asc' id='<cms:show linked_event />' >


You can find more on single versus double quotes here - http://docs.couchcms.com/concepts/setti ... eters.html

That said, although your approach will work, I think a more user-friendly method would have been to use 'relations' (http://docs.couchcms.com/concepts/relationships.html). I wonder if you looked at that as a solution?
Thank you KK, that did the trick woohoo!!!!

Yes i did check relations, but it confused me a little bit - but would be the way to go. But in this case it's just two pages that will use this related thing and it's noting super important! Thanks again bud!

I love couch !!! 8-) :D
You are welcome :)
4 posts Page 1 of 1