We are transitioning over to a new forum platform. Please post new issues there. Existing threads will be dealt with here unless you choose to move them over. Visit the new forum

Forum

Thread tagged as: Question, Problem

Repeating Info Already Added

Hi, I'm new to Perch and must be missing something simple but I can't get this to work. I've set up a HTML template (footer-contact.html) which uses the code below which in the Admin asks for contact details, Address, Telephone, Fax and Email. This block is displayed at the footer of each page using <?php perch_content('Footer Contact Info'); ?> to draw it in.


<p><perch:content id="Address" type="smarttext" label="Address" help="Fulmart Feeds address" required="true" /><br> Telephone: <perch:content id="Telephone" type="smarttext" label="Telephone" help="Fulmart Feeds telephone number" required="true" /><br> Fax: <perch:content id="Fax" type="smarttext" label="Fax" help="Fulmart Feeds fax number" required="true" /><br> Email: <a href="mailto:<perch:content id="Email" type="smarttext" label="Email" help="Fulmart Feeds email address" required="true" />" title="email Fulmart Feeds"><perch:content id="Email" type="smarttext" label="Email" help="Fulmart Feeds email address" required="true" /></a></p>

In the region options for Footer Contact Info I have checked Share Across All Pages and specified footer-contact as the template to use.

In the masthead of each page I wish to display the telephone number and email address which have already been entered into the region above in Admin.

The code in the masthead isn't used as a template, just hard coded as below into the php page:

<h2>T: <?php perch_content('Telephone'); ?> &nbsp; E: <?php perch_content('Email'); ?></a></h2>

When the webpage is displayed the Tel and Email aren't showing in the masthead. The details are shown correctly in the footer.

In the Admin Telephone and Email are shown as NEW and I'm asked to define them. As far as I can understand the IDs 'Telephone' and 'Email' are the same as used in the Footer Contact region so why am I asked for them again in the Admin? Hi, I'm new to Perch and must be missing something simple but I can't get this to work. I've set up a HTML template (footer-contact.html) which uses the code below which in the Admin asks for contact details, Address, Tel, Fax and Email. This block is displayed at the footer of each page using <?php perch_content('Footer Contact Info'); ?> to draw it in.


<p><perch:content id="Address" type="smarttext" label="Address" help="Fulmart Feeds address" required="true" /><br> Telephone: <perch:content id="Telephone" type="smarttext" label="Telephone" help="Fulmart Feeds telephone number" required="true" /><br> Fax: <perch:content id="Fax" type="smarttext" label="Fax" help="Fulmart Feeds fax number" required="true" /><br> Email: <a href="mailto:<perch:content id="Email" type="smarttext" label="Email" help="Fulmart Feeds email address" required="true" />" title="email Fulmart Feeds"><perch:content id="Email" type="smarttext" label="Email" help="Fulmart Feeds email address" required="true" /></a></p>

In the region options for Footer Contact Info I have checked Share Across All Pages and specified footer-contact as the template to use.

In the masthead of each page I wish to display the telephone number and email address which have already been entered into the region above in Admin. If these change I don't want the Admin to type these twice i.e. the contact details, once entered, can be used over and over again and if they are altered they will updated globally.

The code in the masthead isn't used as a template, just hard coded as below into the php page:

<h2>T: <?php perch_content('Telephone'); ?> &nbsp; E: <?php perch_content('Email'); ?></a></h2>

When the webpage is displayed the Tel and Email aren't showing in the masthead. The details are shown correctly in the footer.

In the Admin Telephone and Email are shown as NEW and I'm asked to define them. As far as I can understand the IDs 'Telephone' and 'Email' are the same as used in the Footer Contact region so why am I asked for them again in the Admin?

How can I use the Tel and Email in the masthead from the details entered into the Footer Contact Details region?

Thanks in advance.

Chris Jones

Chris Jones 0 points

  • 2 years ago

Sorry for the duplicated message!

Chris...

if you create a region as <?php perch_content('Telephone'); ?>, then check the option in the admin for Share Across All Pages To use this region on any additional pages you need to use the exact same code... <?php perch_content('Telephone'); ?> to have that shared data show again.

Hi Robert,

Thanks for that. As my template has all the data together I would rather keep that. It is also set to Share Across All Pages. The code in my template is as follows:

<p><perch:content id="Address" type="smarttext" label="Address" help="Fulmart Feeds address" required="true" /><br>
    Telephone: <perch:content id="Telephone" type="smarttext" label="Telephone" help="Fulmart Feeds telephone number" required="true" /><br>
    Fax: <perch:content id="Fax" type="smarttext" label="Fax" help="Fulmart Feeds fax number" required="true" /><br>
    Email: <a href="mailto:<perch:content id="Email" type="smarttext" label="Email" help="Fulmart Feeds email address" required="true" />" title="email Fulmart Feeds"><perch:content id="Email" type="smarttext" label="Email" help="Fulmart Feeds email address" required="true" /></a></p>

So, I should delete the NEW Telephone and NEW Email regions that are shown under Home page and replace the code in the index.php masthead with (identical to my footer template):

<h2>T: <perch:content id="Telephone" type="smarttext" label="Telephone" help="Fulmart Feeds telephone number" required="true" /> &nbsp; Email: <a href="mailto:<perch:content id="Email" type="smarttext" label="Email" help="Fulmart Feeds email address" required="true" />" title="email Fulmart Feeds"><perch:content id="Email" type="smarttext" label="Email" help="Fulmart Feeds email address" required="true" /></a></h2>

I'll give that a go if correct.

Repeating Regions, repeat the entire region; template and all.

I don't think your understanding correctly about how this works.

A field in another region's template even though the same id="myFancyField" will not display the field of the same name from another region just because it's part of a shared region. Shared regions work like:

index.php has region <?php perch_content('Telephone'); ?>. If you want to use this same info again on the page and you add <?php perch_content('Telephone'); ?> it will display the same data a second time, but will only be a single edit in the admin.

now on page address.php if you use <?php perch_content('Telephone'); ?>(which is a shared region) the output is going to be exactly the same as the region output on page index.php