Skip to content

Instantly share code, notes, and snippets.

@jeromecoupe
Created August 23, 2012 13:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jeromecoupe/3436758 to your computer and use it in GitHub Desktop.
Save jeromecoupe/3436758 to your computer and use it in GitHub Desktop.
exp:ifelse and playa conditionals
<!--
Using this code in an embed, passing the father entry_id as {embed:myentryid}
This works natively but as soon as I add ifelse, it breaks
Could stash value of playa conditionals but rather avoid it if possible
Have tried multiple ways of quoting things
{if "{exp:playa:total_children entry_id='{embed:myentryid}' channel='projects|news|pressreleases|documents' status='open'}" != "0"}
{if {exp:playa:total_children entry_id="{embed:myentryid}" channel="projects|news|pressreleases|documents" status="open"}}
etc.
-->
{exp:ifelse parse="inward"}
{if "{exp:playa:total_children entry_id='{embed:myentryid}' channel='projects|news|pressreleases|documents' status='open'}" != "0"}
<section class="box_section">
<h1 class="box_title">More Information</h1>
<p>Related information has been published.</p>
<ul class="mediumlist">
{if "{exp:playa:total_children entry_id='{embed:myentryid}' channel='projects' status='open'}" != "0"}
<li><a href="{path='projects/related_projects/{embed:myentryid}'}">Related Projects</a></li>
{/if}
{if "{exp:playa:total_children entry_id='{embed:myentryid}' channel='news' status='open'}" != "0"}
<li><a href="{path='news_press/related_news/{embed:myentryid}'}">Related News</a></li>
{/if}
</ul>
</section>
{if:else}
{exp:channel:entries disable="categories|category_fields|member_data|pagination|trackbacks" entry_id="{embed:myentryid}" status="open" dynamic="no"}
{if channel_short_name == "pressreleases"}
{!-- low variable --}
{lv_sidebar_pressofficer}
{if:else}
{!-- low variable --}
{lv_sidebar_getintouch}
{/if}
{/exp:channel:entries}
{/if}
{/exp:ifelse}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment