Thread tagged as: Question, Problem

Different Default Attributes for Different Page Templates

I'm trying to set different 'attributes' for a page based upon the template chosen. I have the following code at the head of the template:

<?php include($_SERVER['DOCUMENT_ROOT'].'/kpanel/runtime.php'); include($_SERVER['DOCUMENT_ROOT'].'/_includes/config.php'); $start = microtime(true); perch_layout('perchHead', array( 'pageType'=> 'product', )); perch_page_attributes(array( 'template' => 'carpets.html' )); $pageTitle = perch_pages_title(true); $siteName = perch_content_custom('Contact Details', array('template' => 'contact_details/site_name.html'), true); PerchSystem::set_var('siteName', $siteName); ?>

Yet when a new page is selected, the attribute template shown is the default template.

I'm aware this can be changed via a drop down menu afterwards, but what am I doing wrong for it not to inherit the 'carpets' template when created?

Tony Astley

Tony Astley 0 points

  • 3 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

Is it set to copy the options from an existing page?

No. Can this be automatically set in the template code?

I'm trying not to have the end user do anything other than choose the correct template.

Drew McLellan

Drew McLellan 2638 points
Perch Support

No, but you can set it in the master page options, and that only needs to be done once.

Hello Drew,

I can set it to copy regions, but there is no option to set default attributes.

To clarify I'm referring the the templates that reside in the 'site-folder/perch/templates/pages/attributes' directory.

As far as I can tell this can only be set at page level in the settings tab.

Drew McLellan

Drew McLellan 2638 points
Perch Support

It should copy the selection of the attribute template, but not the content held in the attributes themselves.

Doesn't do it for me Drew,

No matter what I try it always uses the 'default.html'. I can provide a screen recording if it would help to show you the steps involved, to see what I'm doing wrong:

  • Create a page (from a master page).
  • Change the newly created pages attributes from the default set to the desired set.
  • Save page.
  • Open the master page from'Master Pages' option in menu.
  • Tell it to copy region options from newly created page, submit action.
  • Create a new page from the master.
  • New page shows the default attributes template, not the desired one.

I've got to be doing something wrong as you say it can be done?

Drew McLellan

Drew McLellan 2638 points
Perch Support

If that's not working, then no, there's no way to do it.

Is this likely to be added?

This feature would be very, very useful to designers like me who would like varying small amounts of perch:pages attribute content available to the navigation (snippets of text, thumbnail images etc).

I know this is possible for users to change later on, but they won't/don't and the more we can do for them, the less we have to do.

Drew McLellan

Drew McLellan 2638 points
Perch Support

It should be happening now, so yes, it's likely to be fixed.

Great! :-)