1

I’m trying to embed categories into a Switchee value field but can’t get it to work. Can you help?

To try to deal with the parsing order problem, I call the Switchee embed from my site/index template:

{embed="site/.cases" categories="{exp:channel:categories category_group="1" style="linear" backspace=“1”}{category_url_title}|{/exp:channel:categories}"}

And this is the site/.cases template:

{exp:switchee variable="{segment_1}" parse="inward"}

    {case value="{embed:categories}"}
        {embed="site/page" channel="page"}
    {/case}

    {case default="yes"}
        {embed="site/404"}
    {/case}

{/exp:switchee}

It fails.

I tried embedding via Low Variables and Template Morsels both directly and through a similar embed method as above and they failed, too.

I’m at my wits end! Any tips?

6
  • 1
    If you output the value of {embed:categories} outside of switchee, does the formatting match segment_1? Apr 24, 2014 at 14:42
  • Yes, my output is: category_1|category_2|category_3 which would make a match of the following URL: example.com/category_1 Apr 24, 2014 at 15:37
  • So you're getting the default, even when you expect a seg1 match? Might also check what the template debug for switchee says using debug="yes" parameter. Apr 24, 2014 at 18:06
  • That's right, Romans: Switchee: evaluating variable about (0.049297 / 6.95MB) Switchee: default case found for variable 'about'. This will be returned if no match is found. Apr 24, 2014 at 18:12
  • To clarify, if I create embed a Low Variable into the case value like this: {case value="{lv-categories}"} {embed="site/page" channel="page"} {/case} And then define the Low Variable as my categories... about|sample-category|support|visit ...it works. But if, in my Low Variable I replace it with what will generate the same thing... {exp:channel:categories category_group="1" style="linear" backspace="1"}{category_url_title}|{/exp:channel:categories} ...it fails. Apr 24, 2014 at 18:25

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.