Forum
question on re-using content from part of template
I have a region on a page that uses a template that allows multiple items - this produces a listing of items with photo, description, details and a url link for each.
if I make that region 'shared' is it possible to just use one item of info from that template elsewhere on other pages? user wants to have a list of only the url links elsewhere on site.
many thanks
Don't make the region shared- you'll be loading all the items for every page. Instead, use
perch_content_custom()
to get the item you need.thanks Drew that looks great
Thanks Drew - but do I NEED 'value'? not sure what I would put in there. from my initial question I want to display all URLs
template fragment in question
<a href="<perch:content id="venuelink" type="text" label="full page name to link to" html="false" required="true" />">View more details...</a>
Thanks
You don't need to filter it, no. I thought that's what you were implying by saying you only wanted to display one item.
thanks. one final question on this... should I actually create an array, if I want all items for the particular field to show?
I'm not sure I follow.
sorry I am not being clear.
from the initial page which displays a listing of several items, with details incl picture, description and url, I want to be able to display a list of all the urls for the items
if I use perch content custom I was asking if I would need to create an array to show the list of urls
No, use a template that only has the fields you want in it.
Sorry still cant get this to work
Hope to be clear - I have a region on one page that uses a template that allows multiple items and so outputs a list of venue names with photo, description and url to link to.
I want to re use the venuename and venuelink values on another page to produce just a list of hyperlinked venue names
I would use this template for that list
<perch:before> <ul > </perch:before> <li >
<a href="<perch:content id="venuelink" type="text" />"><perch:content id="venuename" type="text" /> </a> </li> <perch:after> </ul> </perch:after>
On the page in question nothing gets output using perch_content_custom as below
I don't think you want a filter then. Leave the filters alone - just use the reduced template.
ah hah - we got there in the end, thanks Drew, excellent as always!