Hi-
I don’t often use related_entries functionality, but I need it now. I’ve read all the EE documentation, but I’m not getting the expected results from my templates. I’m banging my head against a wall trying to understand the logic / syntax.
In short, I have a “products” channel with a relationship field from the same channel. This relationship allows a subproduct to be connected to a main product when appropriate. For example, “Louvered Interior Shutters” as a subproduct entry of the “Interior Shutters” entry (both of which are in the “Shutters” Channel.
I want my template to test whether the current entry is a “parent” page. If so, show some of its relevant “parent page” fields, and then list links to the subordinate pages. If it’s not a parent page, then go ahead and show a different set of details of the page. I’m using the same template for both conditions.
In the code I’ve created, nothing in the “if no_reverse_related_entries” conditional is being parsed. No custom fields, and not even fields like {title}. Those fields get sent as plain text, and render as “{title}” right on the page.
Aside from the specific issues with the reverse_related_entries conditional, am I even approaching this the right way logically, or is there a cleaner, more intuitive solution?
Thanks for your help.
My products/index.html template looks like this:
{exp:channel:entries channel="products"}
{reverse_related_entries}
<a href="http://{url_title_path=products}">{url_title}</a> {!-- build some links to the subproduct pages if appropriate --}
{if no_reverse_related_entries} {!-- its an end level page, so show a bunch of details --}
<div class="span5">
<h2 class="underline">{title}</h2>
{page}
{edit_this}
</div>
<div class="span6 offset1">
<ul class="thumbnails">
{exp:channel_images:images entry_id="{entry_id}"}
<li class="span2"><a href="http://{image:url:medium}" rel="group" title="{image:description}" class="thumbnail fancybox">{image:url:small}</a></li>
{/exp:channel_images:images}
</ul>
</div>
{/if} {!-- no_reverse_related_entries --}
{/reverse_related_entries}
{/exp:channel:entries}