Forum
Does perch:pages only work in navigation templates?
I'm struggling to get a page attribute I set for an image to show in anything other than navigation templates
<perch:pages id="pageImage" width="1280"/>
It works fine in navigation templates but not standard content templates.
Please show all of your code, it's hard to help when you just post snippets.
Also - as always - the short Diagnostics Report.
I have a extended set of attributes that asks the user for a page image/thumbnail:
I do this because to my knowledge the only way of accessing/looping through content from other pages is if it exists as an attribute.
This code in my navigation template works fine and the image is returned where required:
However when using more or less the same code in a content template, the template fails to return anything for the <perch:pages id="pageImage" width="960"/> or <perch:pages id="pageImage" width="960"/>.
Passing them into the template as variables isn't really an option as the variable defaults to one image size.
Page attributes aren't exposed to content templates - the content region doesn't know anything about the page context when it's rendered.
The only way to do it will be to template the page attribute and then pass it into the region, and render the region using
perch_content_custom()
When passing the 'pageImage' attribute through it always defaults to the 480 width, is there a way of controlling which size gets sent through?