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: Problem

Unable to suppress when calling a template which contains a repeater on a collec...

I have a collection which calls the following template:

<perch:content id="programme_slug" type="slug" label="Slug" for="heading" editable indelible="true" suppress>
<perch:content type="checkbox" id="programme_coming_soon" label="Coming soon?" value="true" suppress>

<h1 class="c-programme__title">
  <perch:if exists="programme_coming_soon">
    <span class="c-programme-card__soon">Coming soon: </span>
  </perch:if>
  <perch:content type="text" id="programme_title" label="Title" title="true">
</h1>

<div class="c-programme__content">  

  <div class="c-programme__intro">
    <perch:content type="textarea" id="programme_intro" label="Introduction" editor="redactor" html="true">
  </div>

  <div class="c-programme__description">
    <perch:content type="textarea" id="programme_description" label="Description" editor="redactor" html="true">
  </div>

</div>

<div class="c-programme__quote">
  <perch:template path="quote.html">
</div>

<perch:template path="meta.html" suppress>

<perch:template path="additionals.html" suppress>

The additionals template is as follows:

<perch:repeater id="additionals" label="Additional content blocks">
  <div class="c-additional">
    <perch:if exists="additional_title">
      <h3 class="c-additional__title"><perch:content type="text" id="additional_title" label="Title"></h3>
    </perch:if>
    <div class="l-row">
      <div class="c-additional__intro">
        <perch:content type="textarea" id="additional_intro" label="Intro" editor="redactor" html="true">
      </div>
      <div class="c-additional__copy">
        <perch:content type="textarea" id="additional_copy" label="Copy" editor="redactor" html="true">
      </div>
    </div>
  </div>
</perch:repeater>

The suppress works on the meta include which just has standard perch:content but does not when calling the additionals file which starts with the perch:repeater.

Any ideas?

Perch Runway: 3.1.2, PHP: 7.2.8, MySQL: mysqlnd 5.0.12-dev - 20150407 - $Id: 38fea24f2847fa7519001be390c98ae0acafe387 $, with PDO Server OS: Darwin, apache2handler Installed apps: content (3.1.2), assets (3.1.2), categories (3.1.2), perch_blog (5.6.1), perch_events (1.9.5) App runtimes: <?php $apps_list = [ 'perch_blog', 'perch_events', ]; PERCH_LOGINPATH: /perch PERCH_PATH: /Users/bmozza/Projects/quaich/perch PERCH_CORE: /Users/bmozza/Projects/quaich/perch/core PERCH_RESFILEPATH: /Users/bmozza/Projects/quaich/perch/resources Image manipulation: GD PHP limits: Max upload 32M, Max POST 8M, Memory: 128M, Total max file upload: 8M F1: 3b606135b33e6a102526838f4152a807 Resource folder writeable: Yes HTTP_HOST: me.local:5757 DOCUMENT_ROOT: /Users/bmozza/Projects/quaich REQUEST_URI: /perch/core/settings/diagnostics/ SCRIPT_NAME: /perch/core/settings/diagnostics/index.php

Studio Daughter

Studio Daughter 0 points

  • 8 months ago

Ok, maybe I see now that the perch:template cannot be suppressed. However, I'm not sure how to handle a situation where I want fields to be editable but not output yet... which is due to this in my php template...

<?php $programme = perch_get('s'); ?>
      <div class="c-programme c-programme--<?php echo $programme ?>">
        <div class="l-row">
          <?php 
            perch_collection('Programmes', [
              'template' => 'programme.html',
              'filter' => 'programme_slug',
              'match'  => 'eq',
              'value'  => $programme,
              'limit' => 1
            ]);
          ?>
          <div class='c-programme__dates'>
            <h5 class='c-programme__subtitle'>Upcoming dates</h5>
              <ul class='c-programme__calendar'>
                <?php 
                  $events = perch_collection('Events', [
                    'filter' => 'programme.programme_slug',
                    'match'  => 'eq',
                    'value'  => $programme,
                    'limit' => 3,
                    'skip-template' => true
                  ]);

                  perch_collection('Events', [
                    'filter' => 'programme.programme_slug',
                    'match'  => 'eq',
                    'value'  => $programme,
                    'limit' => 3,
                    'template' => 'events-listing.html'
                  ]);

                  if(empty($events)){
                    echo "<li class='c-programme__event'><time>TBA</time></li>";
                  }
                ?>
              </ul>
            </div>
          </div>
        </div>
      </div>
      <div class="l-row">
        <section class="c-programme__additionals">
          <?php 
            perch_collection('Programmes', [
              'template' => 'additionals.html',
              'filter' => 'programme_slug',
              'match'  => 'eq',
              'value'  => $programme,
              'limit' => 1
            ]);
          ?>
        </section>
      </div>
Hussein Al Hammad

Hussein Al Hammad 105 points
Registered Developer

However, I'm not sure how to handle a situation where I want fields to be editable but not output yet...

While Perch allows you to use the same template for editing and output, you don't have to do it this way.

Your programme.html can be just for editing (i.e. just Perch tags, no HTML). And you can have separate templates for outputting different parts of the item e.g. programme_meta.html, programme_list.html, programme_detail.html, etc.