0

This is the first time i've used Switchee and it's not outputting anything.

The code looks correct. Any thoughts?

gallery_type is a P&T Switch field.

(I've simplified the code for sake of the example and it still is not outputting anything.)

{exp:channel:entries channel="collections" disable="categories|category-fields|member-data|pagination" status="open" limit="1"}
{exp:switchee variable="gallery_type" parse="inward"}
{case value="portrait"}
Portrait
{/case}

{case value="landscape"}
Landscape

{/case}
{/exp:switchee}
{/exp:channel:entries}
2

By this way, the gallery_type isn't being parsed by the exp:channel:entries.

Try this:

{exp:channel:entries channel="collections" disable="categories|category-fields|member-data|pagination" status="open" limit="1"}
    {exp:switchee variable="{gallery_type}" parse="inward"}
        {case value="portrait"}
            Portrait
        {/case}

        {case value="landscape"}
            Landscape

        {/case}
    {/exp:switchee}
{/exp:channel:entries}

Let me say that if there isn't any other module tags, you could use traditional conditionals and to have the same performance, because exp:channel:entries already load everything.

But, if you are using another module inside the cases, switchee is a good call.

| improve this answer | |

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.