Forum

Thread tagged as: Question, Error, Api

Perch tags showing in rendered HTML

Hi all,

I've just started with Perch, and within just a few hours ive got some pages/masterpages up and running - so far working with Perch is an absolute joy!

One thing is throwing me off a little. I have created a masterpage, with very simple markup, as shown below:

<?php if (!defined('PERCH_RUNWAY')) include($_SERVER['DOCUMENT_ROOT'].'/perch/runtime.php'); ?>
<!doctype html>
<html lang="en">
<head>
    <meta charset="utf-8" />
    <title><?php perch_pages_title(); ?></title>
  <?php     
    perch_page_attributes(array(        
      'template' => 'seo.html'    
    )); 
    ?>
    <?php perch_get_css(); ?>
</head>
<body>
    <h1><?php perch_content('Main heading'); ?></h1>

    <?php perch_pages_navigation(array('levels'=>1)); ?>

    <?php perch_content('Intro'); ?>

  <perch:if id="Dummy">
    <h2>
      <perch:content id="ListDescription" type="text" label="Heading" required="false" />
    </h2>
  </perch:if>

  <?php perch_layout('global.footer'); ?>
    <?php perch_get_javascript(); ?>
</body>
</html>

The issue I'm having is that the <perch:if> tag is not being evaluated, it's actually being rendered in the HMTL, which I know is not the intended result.

This template is for a "service" page. I need to store data "ListDescription" on each of the service pages, but the data will not actually be rendered on that page. There is a parent page, services, which will list each of the child pages and display the ListDetails. I wasnt sure how to do this, so I thought one approach could be to use the IF tag and evaluating the id of the field "ListDescription" against a "dummy" value, that way I was hoping Perch would realise it was a content tag, but would never show it on the page.

Any help would be greatly appreciated.

Kind regards, Al

Al Higgs

Al Higgs 1 points

  • 7 years ago

Al, maybe you need <perch:if exists="ListDescription">...</perch:if>

You haven't given "if" anything to evaluate.

Hope this helps.

Robert

Drew McLellan

Drew McLellan 2638 points
Perch Support

You've got templates tags in your page - they'll not be evaluated there.

You need to create a region with perch_content() and then use those tags in the region's template.