2

I have entries with the statuses open and featured in my channel "articles". I configured my Relationships field "related_articles" to show articles with "any" status. I use this code in my template (all entries belong to the same channel "articles")

{exp:channel:entries channel="article"}
         {related_articles}
        <p>{related_articles:title}</p>
         {/related_articles}
{/exp:channel:entries}

I expected to see all titles of all related articles but I got only the entries with the status "open".

I tried to explicitly choose the statuses "open" and "featured" or even only "featured" in the field settings page.

I added a status="open|featured" to the channel entries tag. The result was always the same: EE gave me the "open" entries. When I limited my entries to "featured" I got nothing.

I even added another custom status and tried to display those entries, but that didn´t work either.

I checked with PhPMyAdmin, but on the database-level all is fine. My entry has the parent_id of 12 and the two articles I added as related have the child_IDs 6 and 2. child_ID 6 has the status "open" and will be shown in the template, child_ID 2 has the status "featured" and will not be shown in the template.

Since the Relationships field defaults to "any" for all settings options I´m completly clueless, why EE shows this behaviour.

Does anybody know, where EE saves the Relationships-Field settings? At least it´s not exp_fieldtypes in the database.

6

The "limit entries by status" setting for the Relationship field controls what entries are available to select in the control panel - not what entries will display in your templates.

So if you have the field set to "any status", and you've selected child entries with both "open" and "featured" statuses, then your tag will need an explicit status parameter:

{related_articles status="not closed"}
    <p>{related_articles:title}</p>
{/related_articles}

I know you mentioned you tried that, but maybe you added the status parameter to the channel:entries tag instead of the related_articles tag pair?

| improve this answer | |
  • you where right regarding the position of the status parameter. I fixed that and it works for status=not closed, but not for status=open|featured. I have other statuses, that I don't want to show, so I would prefer the open|featured solution. On the field config page I tried to set the status limit to any and to open|featured, but nothing changed on the frontend. – awa Aug 21 '13 at 5:34
  • Can it be, that the Relationships tags work somewhat different, than the normal channel entries tags regarding the status parameter? I fixed it with this workflow: I limit entries by status as part of the field configuration. That means, that editors can only see entries with statuses, that are ok to appear the site. Than I use the status="not closed" to show all entries regardless of the status. That means, that the Relationships tag can only have no status parameter => defaults to status open OR status ="not closed", means show the entire pool. Limiting is done upstream in the field config. – awa Aug 21 '13 at 7:47
  • Hmm, don't think so, just looking at the source code. Very odd! – Derek Hogue Aug 21 '13 at 11:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.