Forum

Thread tagged as: Problem, Blog

Problem outputting blocks from blog app

Hi there,

I'm trying to filter blog entries onto my front page by a select element, but they're just not appearing at all.

No errors being thrown in debug mode. Blog app is the latest version.

Each block has a select element which allows you to choose a month you'd like to output to. I'm showing the 'oct' example here, and in the blog entry, one of the blocks has 'October' selected, so it should in theory appear.

Is there something wrong with the way I'm filtering, or am I trying to make Perch do something it can't?

Thanks.

Page Code:


<?php perch_blog_custom(array( 'filter' => 'month-selector', 'match' => 'eq', 'value' => 'oct', 'sort' => 'postDateTime', 'sort-order' => 'ASC', 'count' => 1, 'template'=>'blog/timeline_post.html' )); ?>

Template code:


<perch:blocks> <perch:block type="bl-writing" label="Writing"> <div class="tl-entry"> <a href="<perch:blog id="writing" type="textarea" editor="redactor" markdown="false" html="true" size="autowidth" label="Your Content" order="1"/>" data-rel="lightcase"> <perch:blog id="excerpt" type="textarea" editor="redactor" markdown="false" html="true" size="m" words="30" label="Excerpt for the Timeline (max 30 words)" order="2"/> </a> <perch:blog id="month-selector" type="select" label="Timeline Month" options="Not Shown|noshow, February|feb, March|mar, April|apr, May|may, June|jun, July|jul, August|aug, September|sep, October|oct, November|nov" allowempty="false" help="If you'd like your entry to be shown in the timeline, select a month for it to appear." order="3"/> </div> </perch:block> <perch:block type="bl-social" label="Social Media"> <div class="tl-entry"> <perch:blog id="social-embed" type="text" label="Embed code for Twitter or Instagram goes here" order="1"/> <perch:blog id="month-selector" type="select" label="Timeline Month" options="Not Shown|noshow, February|feb, March|mar, April|apr, May|may, June|jun, July|jul, August|aug, September|sep, October|oct, November|nov" allowempty="false" help="If you'd like your entry to be shown in the timeline, select a month for it to appear. " order="3"/> </div> </perch:block> </perch:blocks>

Diagnostic report:


HEALTH CHECK Perch is up to date PHP 5.6.6 is up to date MySQL 5.5.43-0ubuntu0.14.04.1-log is up to date Image processing available SUMMARY INFORMATION Perch: 2.8.6, PHP: 5.6.6, MySQL: mysqlnd 5.0.11-dev - 20120503 - $Id: 3c688b6bbc30d36af3ac34fdd4b7b5b787fe5555 $, with PDO Server OS: Linux, fpm-fcgi Installed apps: content (2.8.6), assets (2.8.6), categories (2.8.6), perch_blog (4.6), perch_forms (1.8.3), perch_backup (1.2), perch_twitter (3.5.1) App runtimes: <?php $apps_list = array( 'content', 'categories', 'perch_twitter', 'perch_forms', 'perch_blog' ); PERCH_LOGINPATH: /perch PERCH_PATH: /srv/users/serverpilot/apps/stagingwalesinvenice/public/perch PERCH_CORE: /srv/users/serverpilot/apps/stagingwalesinvenice/public/perch/core PERCH_RESFILEPATH: /srv/users/serverpilot/apps/stagingwalesinvenice/public/perch/resources Image manipulation: GD PHP limits: Max upload 128M, Max POST 128M, Memory: 128M, Total max file upload: 128M Resource folder writeable: Yes HTTP_HOST: staging.experiencewalesinvenice.org DOCUMENT_ROOT: /srv/users/serverpilot/apps/stagingwalesinvenice/public REQUEST_URI: /perch/core/settings/diagnostics/ SCRIPT_NAME: /perch/core/settings/diagnostics/index.php
David Shepherd

David Shepherd 0 points

  • 6 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

You can't filter on fields in blocks (because there are potentially lots of them with potentially conflicting values). Any fields you need to filter by should appear outside of the blocks.

Aha, ok thanks Drew - looks like I'll have to work out a new approach.

Thanks for your speedy help.