0

I am getting a syntax error when trying to set-up switchee on a new ee site. I am in 3.5.10 and I am using switchee v. 3.0. This is the first time using it in 3.x have used it several time on two ee 2.x site with out a problem. Not sure what is going on. Here is the code:

{exp:switchee variable="{segment_2}" parse="inward"}
{case value=""}
    {embed="includes/.page-content-landing"}
{/case}

{case default="yes"}
    {embed="includes/.page-content-detail"}
{/case}
{/exp:switchee}

Thanks...

0

I did not have it installed correctly.

| improve this answer | |
0

If you are only choosing between two values, I'd replace {switchee} with a simple {if} statement - and perhaps save on an addon. {switchee} was a particular solution to a weakness in pre-2.9 versions of EE, and now really only useful if you value the syntax options it provides.

So I'd try something like this:

{if segment_2 == ""}
    {embed="includes/.page-content-landing"}
{if:else}
    {embed="includes/.page-content-detail"}
{/if}

Also, if your use of embed is simply to drop in template code (which seems likely as you are not passing any embed variables) you might also want to consider replacing them with layout variables.

HTH

| improve this answer | |
  • This work ... so I should just drop using {exp:switchee} – seeingis Aug 7 '17 at 15:32
  • Yep - I would. The fewer addons you use, the less messy things are when EE gets updated. – JCOGS Design Aug 7 '17 at 17:52

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.