2

I have a set of "category" pages such as:

  • Dining (example.com/dining)
  • Nightlife (example.com/nightlife)

We are using Zoo Triggers to filter out the categories appropriately. I am using a snippet to insert an icon into the header of each category. This snippet looks like so:

{exp:stash:set name="logo"} 
    {snippet:masthead_logo}
{/exp:stash:set}

The "logo" snippet looks much like this:

<div class="logo">
{exp:ifelse parse="inward"}
{if segment_1=='events'}
    <img src="{site_url}images/placeholders/icon-events.png" height="125" width="125"/>
{if:elseif triggers:segment_1=='dining'}
    <img src="{site_url}images/placeholders/icon-dining.png" height="125" width="125"/>
{if:elseif segment_1=='nightlife'}
    <img src="{site_url}images/placeholders/icon-nightlife.png" height="125" width="125"/>  
{if:elseif segment_1=='shopping'}
    <img src="{site_url}images/placeholders/icon-shopping.png" height="125" width="125"/>
{if:elseif segment_1=='arts-culture'}
    <img src="{site_url}images/placeholders/icon-arts.png" height="125" width="125"/>
{if:else}
    {exp:ce_img:pair src="{interior_logo}" max="125" crop="no|center,center" fallback_src="{site_url}images/placeholders/member-placeholder-logo.png" allow_scale_larger="yes"}
        <img src="{made}" alt="{title}" width="{width}" height="{height}" />
    {/exp:ce_img:pair}
{/if}
{/exp:ifelse}
</div>

As you can see I am testing "dining" for Zoo Triggers segment_1, which is 'dining' when it parses. However, the conditional is not holding true as it were. In fact, not even the surrounding is passed from the snippet. So I suppose it isn't as much a why isn't this conditional working, but more of a why isn't this snippet working?

5
  • 1
    FYI: The icons DO in fact display when the URL is www.example.com/dining, but when it is www.example.com/dining/category/thai do we run into the issue of the empty stash. – Dan Johnson Dec 3 '12 at 20:06
  • 1
    Do you need to use the triggers segment if the dining images does not change between www.example.com/dining and www.example.com/dining/category/thai? – Justin Long Dec 3 '12 at 20:07
  • No, it was just a test. Drilling down. It seems anything inside the {exp:channel:entries disable="trackbacks|pagination" {triggers:entries}} tag does not stash properly. – Dan Johnson Dec 3 '12 at 20:16
  • 2
    Have you tried setting parse_conditionals="yes" on the {exp:stash:set} tag? – Tom Davies Dec 3 '12 at 20:59
  • 1
    I had. It turns out to be user error of course! I had a misplaced tag, that killed everything. – Dan Johnson Dec 3 '12 at 22:03
2

In your code above 'logo' is a Stash variable, not a snippet. You would need to access it like {exp:stash:get name="logo"}. You could add type="snippet" to the stash:set tag when you set the variable and then access it like so: {logo}; however I'm not sure why you don't just use the original snippet itself: {snippet:masthead_logo} ?

2
  • I updated the code a bit. {logo} should actually have been {interior_logo}. The stash:set is inside a channel:entries tag because in some instances a page requires a custom logo/icon, but for the most part they are as defined. – Dan Johnson Dec 3 '12 at 21:52
  • Ho hum. Figured it out. User error, of course. Thanks Mark. – Dan Johnson Dec 3 '12 at 22:02
1

I tracked the issue down and it was an errantly placed {triggers:entries} tag. Completely my fault, but thankful that I had the answers I received to make me look long and hard at the template.

Thanks all!

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.