Skip to main content
added 217 characters in body
Source Link

Well, I have concluded that there is no way to use a conditional inside the matrix/playa code, which is a big disappointment. I even tried the trick with the variable prefix, and it didn't work.


Well, I have concluded that there is no way to use a conditional inside the matrix/playa code, which is a big disappointment. I even tried the trick with the variable prefix, and it didn't work.

added 1214 characters in body
Source Link

here is my template: Note that I can't get ANY type of conditional statement to work where indicated in the comment, but the 2 conditionals outside the EE channel tag DO work.

<!-- news promos using Matrix & Playa fields -->
{exp:channel:entries channel="home_page" disable="categories|category_fields|member_data|pagination" limit="1" dynamic="off" show_future_entries="yes"}
            <!-- start matrix field -->
            {homepage_news_4items}
                    {!-- start playa field within the matrix --}
                    {hp_news_promo}
                    <li>
                        <em>{entry_date format="%M. %j, %Y"}</em>
                        <div class="text">
                            <!-- need to insert an EE conditional statement on this line to replace the xxxxxxx --><a href="{path='/xxxxxxxx/{url_title}'}">{exp:word_limit total="7"}{news_long_title}{/exp:word_limit}</a>
                        </div>
                    </li>
                    {/hp_news_promo}
                    {!-- end playa field within the matrix --}
            {/homepage_news_4items}
            <!-- end matrix field -->
{/exp:channel:entries}
<!-- /news promos using Matrix & Playa fields -->



{if username == 'rory'}Hi Rory!{/if}

{if segment_2 == 'march14test'}this is the test template{if:else}wrong URL{/if}

----- END TEMPLATE

Here's what I want to insert as a conditional on the line indicated (to replace the whole line):

{if channel_short_name == "industry_news"}{if:else}{/if}{exp:word_limit total="7"}{news_long_title}{/exp:word_limit}

here is my template: Note that I can't get ANY type of conditional statement to work where indicated in the comment, but the 2 conditionals outside the EE channel tag DO work.

<!-- news promos using Matrix & Playa fields -->
{exp:channel:entries channel="home_page" disable="categories|category_fields|member_data|pagination" limit="1" dynamic="off" show_future_entries="yes"}
            <!-- start matrix field -->
            {homepage_news_4items}
                    {!-- start playa field within the matrix --}
                    {hp_news_promo}
                    <li>
                        <em>{entry_date format="%M. %j, %Y"}</em>
                        <div class="text">
                            <!-- need to insert an EE conditional statement on this line to replace the xxxxxxx --><a href="{path='/xxxxxxxx/{url_title}'}">{exp:word_limit total="7"}{news_long_title}{/exp:word_limit}</a>
                        </div>
                    </li>
                    {/hp_news_promo}
                    {!-- end playa field within the matrix --}
            {/homepage_news_4items}
            <!-- end matrix field -->
{/exp:channel:entries}
<!-- /news promos using Matrix & Playa fields -->



{if username == 'rory'}Hi Rory!{/if}

{if segment_2 == 'march14test'}this is the test template{if:else}wrong URL{/if}

----- END TEMPLATE

Here's what I want to insert as a conditional on the line indicated (to replace the whole line):

{if channel_short_name == "industry_news"}{if:else}{/if}{exp:word_limit total="7"}{news_long_title}{/exp:word_limit}

Tweeted twitter.com/#!/StackExpression/status/444105510066085888
Source Link

conditional based on what channel the entry selected in a playa field is in?

I have a matrix field that has 1 column, which is a playa field.

The playa field is set up to allow the user to choose any open entry within 2 different channels. I need to display code in the template that has a conditional the chooses 2 options based on what channel the selected entry (chosen in the playa field) is from.

In other words: user selects an entry in the playa field. That entry can be from either channel A or channel B. I need conditional code that displays one thing if the selected entry is from channel A, and something different if the selected entry is from channel B.

How do I do that? Thanks!!!