Forum
Perch page attribute setting shows up in details but can't use it in a template
I placed
<perch:template path="pageoptions" />
In my default.php file and created my "pageoptions.html" file in "templates/pages/attributes" directory. The options show up in the details tab. I want to use those options on the navigation of the site (one being an image) but it won't output.
My pageoptions.html:
<perch:pages id="sidebar_img" label="Navigation Background" type="image" />
I have a content region in a template being called using (passing values from blocks to the sidebar)
perch_content_custom('Sections',[
'template' => 'sidebar.html'
]);
In sidebar.html I'm request the page attribute via:
<img src="<perch:pages id="sidebar_img" type="image" />" />
According to https://docs.grabaperch.com/video/v/page-attributes/ this should work but it doesn't return anything. (I made sure the image is provided in the page details)
perch_content_custom()
won't render page attributes unless you explicitly pass them in.perch_pages_navigation()
will, however.Is it possible to pass them over via the data attribute:
Answer:
home.php:
sidebar.html: