Forum

Thread tagged as: Question
Drew McLellan

Drew McLellan 2638 points
Perch Support

Yes - if you want to output the result you need to add it to your template.

Hi Drew,

OK, nearly there I think...

The final hurdle I am struggling with is to get the items on the page rather the markup printing on the page.

Page code

<?php
        $productType = perch_categories(array(
          'set'=>'product-category',
          'template'=>'abc.html',
          'filter'=>'catID',
          'match'=>'gt',
          'value'=>'0',

          'each' => function($item) {
              $item['test'] = perch_content_custom('Products',array(
                  'page'=>'/products.php',
                'category'=>$item['catPath'],
                'template'=>'datasheets.html',
              ),true);

              return $item;
          },
        ));
        ?>

Template 'abc.html'

<perch:if different="catTitle">
    <h3><perch:category id="catTitle" /></h3>
</perch:if>

<ul class="downloads">
    <perch:category id="test" />
</ul>

Template 'datasheets.html'

<perch:repeater id="datasheets" label="Datasheets">
    <li><a href="<perch:content id="datasheet" type="file" label="Datasheet PDF" bucket="datasheets" order="9" />"><perch:content id="datasheet_title" type="text" label="Datasheet Title" required="true" size="xl" order="8" divider-before="Datasheets" /></a></li>
</perch:repeater>

Any idea what I'm doing wrong?

Drew McLellan

Drew McLellan 2638 points
Perch Support

Add encode="false" to the tag to prevent it encoding HTML.

Drew McLellan said:

Add encode="false" to the tag to prevent it encoding HTML.

Excellent, that's cracked it. Thanks Drew.