Forum

Thread tagged as: Question, Problem

Repeaters and Related Collections

Hi,

I have a Repeater in a Collection that I'm trying to use with a Related Collection but I'm not getting any output.

I've found a couple of other posts here that appear to describe the same issue (https://forum.grabaperch.com/forum/05-08-2017-repeater-items-not-showing-up-in-related-collection-items, https://forum.grabaperch.com/forum/02-11-2016-repeaters-inside-a-relationship).

Are repeaters still not available in this way (in related items)?

Thanks in advance.

Simon Kelly

Simon Kelly 0 points

  • 3 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

Is the repeated in the related item or in the relationship? I'm not completely sure what you're asking.

Hi Drew,

I've made a test to show what I'm trying to achieve.

I have a Collection called Facts and another called Content. The idea is that Facts will hold data about a real estate property (sizes, images, prices etc) and Content will contain the words and descriptions.

Here's a reduced Facts collection template with a couple of text fields and a repeater with an image

<perch:content id="facts_title" type="text" size="m" title="true" />
<perch:content id="facts_desc" type="textarea" size="l" label="Description" editor="markitup" textile="true" />


<perch:repeater id="gallery_items" label="Gallery Images">
<perch:content type="image" id="gallery_image" label="Image" width="640" crop="true" bucket="galleries" />
</perch:repeater>

And here's the Content template which is used to display a couple of item from the Facts collection item:

<perch:content id="item_title" type="text" size="m" title="true" />

<!--*  Related data *-->
<perch:related id="facts_test" collection="Facts Test">
<perch:content id="facts_desc" type="textarea" />
<perch:if exists="gallery_items"><p>Yes, it exists</p>
<perch:before><ul></perch:before>
<li>
<perch:repeater id="gallery_items" label="Gallery Images">
<perch:content type="image" id="gallery_image" label="Image" width="640" crop="true" bucket="galleries" />
</perch:repeater>
</li>
<perch:after></ul></perch:after>
</perch:related>

When I display this on the front-end I see the facts_desc content pulled in as expected, and I also see my 'Yes, it exists' message showing that the repeater is found. But I don't see any output in the <ul> from the repeater.

Furthermore, the Content template in the editor actually shows the Repeater (see screenshot attached)

Repeater showing in template

Thanks for any help or suggestions.

Here's the diagnostics:

Perch Runway: 3.0.13, PHP: 5.6.21, MySQL: mysqlnd 5.0.11-dev - 20120503 - $Id: 76b08b24596e12d4553bd41fc93cccd5bac2fe7a $, with PDO
Server OS: WINNT, apache2handler
Installed apps: content (3.0.13), assets (3.0.13), categories (3.0.13), perch_forms (1.11), jw_translations (1)
App runtimes: <?php $apps_list = [ 'perch_forms', 'jw_translations' ];
PERCH_LOGINPATH: /perch
PERCH_PATH: D:\sites\XXXXXXX\httpdocs\perch
PERCH_CORE: D:\sites\XXXXXXX\httpdocs\perch\core
PERCH_RESFILEPATH: D:\sites\XXXXXXX\httpdocs\perch\resources
Image manipulation: GD
PHP limits: Max upload 256M, Max POST 256M, Memory: 1024M, Total max file upload: 256M
F1: 9fab42554990d2c203d599a6437edd2a
Resource folder writeable: Yes
HTTP_HOST: dev.XXXXXXX
DOCUMENT_ROOT: D:/sites/XXXXXXX/httpdocs
REQUEST_URI: /perch/core/settings/diagnostics/
SCRIPT_NAME: /perch/core/settings/diagnostics/index.php
Drew McLellan

Drew McLellan 2638 points
Perch Support

OK, I'll have to look into this.

OK, thanks Drew.