4

On events pages that meet the first conditional statement (first segment is 'events' and second segment is 'not empty') the image parses as expected. However, when the first segment is 'member-directory' and the second segment is NOT '', the last conditional (if:else) is parsed.

I've tried stripping out tags and replacing them with (A,B,C) and can confirm that it is parsing the (last) if:else when second conditional seemingly should be met.

{exp:ifelse parse="inward"} 
{if segment_1 == 'events' AND segment_2 != ''}
    {exp:ce_img:pair src="{event_masthead}" height="270" min_width="1600" max_width="1600" fallback_src="{lv_fallback_banner}" crop="yes" allow_scale_larger="yes" filter="brightness,-80|grayscale|colorize,80,39,9,10"}style="background:url('{made}') no-repeat 50% 0; height: 270px;"
    {/exp:ce_img:pair}  
{if:elseif segment_1 == 'member-directory' AND segment_2 != ''}
    {member_photo_gallery limit="1"}
        {exp:ce_img:pair src="{url}" height="270" min_width="1600" max_width="1600" crop="yes" fallback_src="{lv_fallback_banner}" allow_scale_larger="yes" filter="brightness,-80|grayscale|colorize,80,39,9,10"}style="background:url('{made}') no-repeat 50% 0; height: 270px width: 1600px;"
        {/exp:ce_img:pair}
    {/member_photo_gallery}
{if:else}
    {exp:ce_img:pair src="{masthead}" height="270" min_width="1600" max_width="1600" fallback_src="{lv_fallback_banner}" crop="yes" allow_scale_larger="yes" filter="brightness,-80|grayscale|colorize,80,39,9,10"}style="background:url('{made}') no-repeat 50% 0; height: 270px;"
    {/exp:ce_img:pair}  
{/if}
{/exp:ifelse}

Here is my fallback test that is showing that the second conditional is not being met.

{exp:ifelse parse="inward"} 
{if segment_1 == 'events' AND segment_2 != ''}
        A
{if:elseif segment_1 == 'member-directory' AND segment_2 != ''}
        B
{if:else}
        C
{/if}
{/exp:ifelse}

This works. I am wondering why Croxtons doesn't. I am using the latest version.

{if segment_1 == 'member-directory' AND segment_2 != ''}
    {member_photo_gallery limit="1"}
        {exp:ce_img:pair src="{url}" height="270" min_width="1600" max_width="1600" crop="yes" fallback_src="{lv_fallback_banner}" allow_scale_larger="yes" filter="brightness,-80|grayscale|colorize,80,39,9,10"}style="background:url('{made}') no-repeat 50% 0; height: 270px; width: 1600px;"
        {/exp:ce_img:pair}
    {/member_photo_gallery}         
{/if}

The snippet is used like so:

{!-- Masthead --}
{exp:stash:set name="masthead" parse_tags="yes"}
{snippet:masthead_background_image}
{/exp:stash:set}
{!-- /Masthead --}
  • 1
    Does the fallback test work without using the Croxton add-on? – foamcow Nov 26 '12 at 16:35
  • @foamcow Edited original with additional test. – Dan Johnson Nov 26 '12 at 16:54
3

It seems that "parse_tags="yes" on the {exp:stash:set} was causing the issue. Seeing that I wanted the tags inside to be parsed, but when I removed it the conditional came back as expected and images parsed.

2

I've fired up your reduced test case in an otherwise empty site index template and it works fine for me:

{exp:ifelse parse="inward"} 
  {if segment_1 == 'events' AND segment_2 != ''}
        A
  {if:elseif segment_1 == 'member-directory' AND segment_2 != ''}
        B
  {if:else}
        C
  {/if}
{/exp:ifelse}

ie I get the following results:

/ = C
/events = C
/events/foo = A
/member-directory = C
/member-directory/foo = B

Is that as desired?

Is there anything else going on in the template that could be relevant?

  • Site is running Structure, Snippet is inside of a "stash:set". I've updated original post to show how it is used in the "model" template. – Dan Johnson Nov 26 '12 at 19:02
  • Obvious qn but worth asking: does processing the {exp:ifelse} alone (ie outside of the {exp:stash:get}) return the desired result? – Tom Davies Nov 26 '12 at 20:22
  • It did. The issue seems to have been the "parse_tags='yes'". – Dan Johnson Nov 26 '12 at 20:27
  • Parse order bites again huh? :-) Gllad you got it sorted anyway... – Tom Davies Nov 26 '12 at 20:28

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.