Forum

Thread tagged as: Question, Error, Runway

perch_template() doesn't render categories

Slightly odd one this one - unless it's something I'm expecting to happen that isn't meant to happen...

Runway 3.1.1
PHP 7.2.5
MariaDB 10.2.15

Template _list_seasons.html:

<perch:before><ol class="play-grid col<perch:content id="count" />"></perch:before>
<li><perch:content id="fullname" /> <perch:categories id="season" set="seasons"><perch:category id="catTitle" /> </perch:categories></li> <perch:showall>
<perch:after></ol></perch:after>

Standard collection call:

perch_collection('Players', ['filter' => 'lastname', 'match' => 'regex', 'value' => '^'.perch_get('index').'[a-z \'-]+$', 'sort' => 'fullname', 'sort-order' => 'ASC', 'template' => 'players/_list_seasons.html']);

Works well - lists multiple players and the categories they have assigned to them.

perch:showall for one item gives:

season        Array
(
    [0] => 6
    [1] => 7
    [2] => 8
    [3] => 9
)

Using perch_template():

$players = perch_collection('Players', ['filter' => 'lastname', 'match' => 'regex', 'value' => '^'.perch_get('index').'[a-z \'-]+$', 'sort' => 'fullname', 'sort-order' => 'ASC', 'skip-template' => true]);

perch_template('content/players/_list_seasons.html', $players);

Lists the players as before, but I get no categories output at all.

perch:showall for the same item gives:

season        Array
(
    [0] => seasons/2011-12/
    [1] => seasons/2010-11/
    [2] => seasons/2009-10/
    [3] => seasons/2008-09/
)

I would expect the output to be the same either way.

Duncan Revell

Duncan Revell 78 points

  • 3 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

I would expect it to, but I'm not totally surprised to hear that it doesn't. I'll have to take a look into it and see what it's doing.