Hi, I’m wondering if I’ve found a bug or am just misunderstanding how the {parents} tag is supposed to work. I’ve got a page with multiple {parents} tags with different offset and limit parameters, but only the first one seems to work correctly—the rest ignore their offset and limit parameters and only seem to show the second related parent item. Any suggestions? Thanks…
I’m on version 5.2.3. I’ve got two channels, one called ‘project’ and one called ‘project_images’ which has a relationship field that links to the ‘project’ channel, and a field called ‘filename’ containing the path to an image describing the project. Each project has multiple images linked to it. Like so:
Project
Project Images
With the code below, the image in the second {parents} tag will always show the first related image, unless its order parameter is the same as in the first {parents} tag. So the example here will show image 2 (because its offset is set to 1) and then image 1 (even though its offset should make it show image 3). If I set the second offset to 1, the second image will correctly show image 2 (since its offset is the same as in the first {parents} tag).
Basically, it seems like the second {parents} tag can only show the first related item, or the item with the same offset as used in the first {parents} tag. Hope this is helpful.
{exp:channel:entries channel="project" limit="1"}
{parents channel="project_images" orderby="url_title" sort="asc" offset="1" limit="1"}
<img src="/images/site_images/{parents:filename}" />
{/parents}
{parents channel="project_images" orderby="url_title" sort="asc" offset="2" limit="1"}
<img src="/images/site_images/{parents:filename}" />
{/parents}
{/exp:channel:entries}
Thanks—unfortunately I don’t think that will work in my case because these elements are nested in a structure that I don’t want to repeat. I don’t believe I can get to the structure below by enclosing the whole thing in a {parents} tag and then using the count parameter because then the outermost divs would get repeated.
FYI this is from an EE 1.6.0 template that I’m porting to EE 5. In the original template, I was able to use {reverse_related_entries} with this structure and it worked.
<div>
<div>
1st project image
</div>
<div>
2nd project image
</div>
</div>
<div>
<div>
3rd project image
</div>
<div>
4th - nth project images
</div>
</div>
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.