All Low add-ons are now owned by EEHarbor. Read the blog post.

Support archive

Compatibility Problems with switchee? (low_title)

albuvee 3 Dec 2012 09:41 problem, complete

If I use low_title:category with a template with multiple exp:switchee-Tags, the output uf exp:low_title:category is kind of strange, as it outputs the content of another switchee-tag or the full html-content of an exp:channel:entry-tag further down the page...

{exp:switchee variable='{segment_2}' parse='inward'}
{case value="#^P#|''"}{embed='_global/.breadcrumb'...}{/case}
{case value='biete'}
{switchee variable='{segment_3}' parse='inward'}
{case value="#^P#|''"}{embed='_global/.breadcrumb'...}{/case}
{case value='cat'}{embed='_global/.breadcrumb' ... last='{exp:low_title:category url_title="{segment_4}"}'}{/case}
{/switchee}
{/case}
{case value='suche'}...{/case}
{case value='cat'}{embed='_global/.breadcrumb' ... last='{exp:low_title:category url_title="{segment_3}"}'}{/case}
{/exp:switchee}

as you can see, I'm using switchee to embed different versions of a breadcrumb-template. In the case «segment_2 == 'biete' AND segment_3 == 'cat'» low_title:category WORKS perfectly ... but in the 'simpler' case «segment_2 == 'cat'» low_title:category shows strange html-content from further down the page instead of name the category, url-titled in segment_3 ... actually it's not 'strange html-content', but it's the content of the next upcoming switchee-tag further down the page

Is there a known bug? Or do I make an error in my code? Or is it a compatibility-problem?

Additional Info: Before I used switchee for this conditionals, I used the ee-native if/else-conditionals — there everything worked fine with low_title. I had to switch to «switchee» because with native ee-conditionals I could not work around the Pagination-Cases (#^P#-Regex in switchee).

Replies

  1. Low 3 Dec 2012 10:00

    There is no reason why Low Title shouldn't be compatible with Switchee -- It's just another plugin like any other.

    I suggest you take a closer look at your Switchee code, perhaps simplifying it a bit.

    albuvee 3 Dec 2012 10:05

    thx for this info, low.
    I will have another look at my switchee-code.

    albuvee 3 Dec 2012 10:12

    btw: it does also not work in a much simpler switchee-code like:

    {exp:switchee variable='{segment_2}'}
    {case value="#^P#|''"}{embed='_global/.breadcrumb' last='News'}{/case}
    {case value='cat'}{embed='_global/.breadcrumb' ... last='{exp:low_title:category url_title="{segment_3}"}'}{/case}
    {/exp:switchee}

    In this case I will also see the content of the next switchee-tag further down the page instead of the category-title.

    For testing-reasons: If I remove the next switchee-tag from further down the page, low_title shows me the rendered image from exp:imgsizer:size instead of the category-title.
    If I also remove this addon-code (imgsizer), it shows me the number «168» (I don't know what this number represents — it's not the category-id, not the count of entries or pages shown ... don't know what it is).

  2. Low 3 Dec 2012 10:14

    Enable the template debugger and look up what tags are actually being processed. What does that tell you?

    albuvee 3 Dec 2012 11:36

    I'm not that experienced with the debugger, but I can find this:

    ...
    (0.020233 / 14.50MB) Parsing Tags in Template
    (0.020269 / 14.50MB) Tag: {exp:low_title:category url_title="hardware"}
    (0.020350 / 14.50MB) No Closing Tag
    ...
    (0.020946 / 14.52MB) Processing Tags
    (0.020990 / 14.53MB) Plugin Tag: Low_title/category
    (0.021014 / 14.53MB) Plugin Tag: Switchee/
    (0.021037 / 14.53MB) Plugin Tag: Switchee/
    (0.021055 / 14.53MB) Module Tag: Channel/categories
    (0.021073 / 14.53MB) Module Tag: Tag/stats
    (0.021091 / 14.53MB) Module Tag: Channel/entries
    (0.021108 / 14.53MB) Including Files for Plugins and Modules
    (0.039053 / 20.91MB) Files for Plugins and Modules All Included
    (0.039708 / 20.95MB) Beginning Final Tag Data Processing
    (0.039733 / 20.95MB) Calling Class/Method: Low_title/category
    (0.039868 / 20.95MB) -> Class Called: Low_title
    (0.039899 / 20.95MB) -> Method Called: category
    (0.051579 / 21.67MB) -> Data Returned
    ...

  3. Mark Croxton 3 Dec 2012 11:54

    If you add debug="yes" to Switchee you will be able to see some more info in the debugger output about what is being matched.

    albuvee 3 Dec 2012 12:02

    For me it looks like switchee does his work here — if I replace the low_title-tag with something static like the word «Category», everything works (but of course without the correct category-name ;-) )

    debugger does not help (ME) finding the bug.

    here an example how it actually looks: http://cl.ly/image/3t063k100z2c

    and how it does, if I use ee-native conditionals (again: I need the RegEx for the Pagination-URLs, therefore (and for performance-reasons) I'm using switchee): http://cl.ly/image/1f1I053r1x00

    Mark Croxton 3 Dec 2012 12:13

    I think this is likely to be a parsing bug. Please make sure to use double quotes for your case values:

    {case value="my-value"}

    Then, please try putting those {case} tag pair on their own lines:

    {case value="cat"}
    {embed='_global/.breadcrumb' ... last='{exp:low_title:category url_title="{segment_3}"}'}
    {/case}

    If that doesn't work, try swapping the quotes around parameters:

    {case value="cat"}
    {embed="_global/.breadcrumb' ... last="{exp:low_title:category url_title='{segment_3}'}"}
    {/case}

    albuvee 3 Dec 2012 12:27

    HAH! THAT'S IT! ... :-) ... the quotes! ... using double-quotes outside and single-quotes inside «does the trick» :-) ... thx you both!

  4. Low 3 Dec 2012 12:28

    Thanks for chiming in, Mark. :)