Forum

Thread tagged as: Problem

Using a different attributes set for a template

Hello,

I'm currently trying to introduce different attribute sets for different page templates. However I can only get attributes I enter into the /perch/templates/pages/attributes/default.html to show up, hence adding any additional attributes introduce to every page (which I don't want).

My goal is to have some page templates have a 'featured image' page attribute. This will then be used in thumbnail style navigation etc.

In my homepage template (perch/templates/pages/homepage.php) I have the following code:

perch_page_attributes(array(
        'template' => 'homepage.html'
));

That template referenced above looks like:

<perch:template path="pages/attributes/seo.html" />
<perch:template path="pages/attributes/page_image.html" />

This calls in the SEO fine, but not the page image.

As mentioned if I introduce the exact same code into the /perch/templates/pages/attributes/default.html pages template the image field appears successfully in the 'Page Details' tab in the admin.

Could anyone enlighten me on where I'm going wrong please?

Tony Astley

Tony Astley 0 points

  • 4 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

Have you selected homepage.html as the attribute template in the Page Options?

I can manually change it for every page using the template in question.

But is there a way to push new attributes template to a page template?

Or if not, is there a way to get master pages to default to using an attribute set when creating new pages?

Drew McLellan

Drew McLellan 2638 points
Perch Support

Yes, you can set a master page to copy its settings from an existing page - it's in the master page config.

That didn't work for me,

I am able to set a master page to copy regions from an existing page, but it doesn't copy the attributes template. The new page always gets created with the default attributes template.

Drew McLellan

Drew McLellan 2638 points
Perch Support

I would have thought it should. We'll take a look at it.

Is there an alternative method of achieving this? A different way to call in content from a region into a menu loop?

Drew McLellan

Drew McLellan 2638 points
Perch Support

The alternative would be to select the template you want - that's a simple step. Better than convoluted workarounds.

A simple step for us maybe, but I'm aiming for the client not to have to think about it - or more importantly ring me to find out why they can't add an image to their page :-)

Leave it there then Drew, thanks for your help.