Thread tagged as: Question, Problem

Filtering using a field within a repeater

I want to know if it's possible to use perch_content_custom to filter the results based on a field within a repeater. I want to do a listdetail, where the detail page just displays one item from the repeater.

My current call is the following which obviously doesn't work:

perch_content_custom('People', array(
               'template' => 'staff_detail.html',
               'filter'   => 'staff-members.slug',
               'match'    => 'eq',
               'value'    => perch_get('s'),
               'count'    => 1,

The staff_detail.html template is:

<perch:content id="year" type="text" label="Year group" required="true" title="true" suppress="true" />
<perch:content id="year-desc" type="textarea" label="Year Description" editor="ckeditor" html="true" suppress="true" />
<perch:repeater id="staff-members" label="Staff">
<h2><perch:content id="name" type="text" label="Name" required="true" title="true" /></h2>
<perch:content id="title" type="text" label="Title" required="true" title="true" /> | <a href="mailto:<perch:content id="email" type="text" label="Email" required="true" title="false" />">Email</a><br />
<img src="<perch:content id="image" type="image" label="Image" width="300" crop="true" bucket="people"  />" align="left" style="padding-right:10px;" /><perch:content id="image" type="image" width="200" height="200" crop="true" bucket="people" suppress="true" />
<perch:content id="desc" type="textarea" label="Description" editor="ckeditor" html="true" />

<perch:content id="slug" for="name" type="slug" suppress="true" />
R T Partridge

R T Partridge 0 points

  • 7 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

You have an unclosed repeater.