ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Parsing of conditionals in an add-on tag pair

November 16, 2010 9:11pm

Subscribe [1]
  • #1 / Nov 16, 2010 9:11pm

    GoElement

    37 posts

    I am using the taxonomy add-on, and within the {exp:taxonomy:nav} tag set (documentation here) I am trying to do a conditional, as follows:

    {exp:taxonomy:nav tree_id="{embed:taxonomy_root}" depth="10" display_root="no" ul_css_id="mainmenu"}
      < a {if node_level != "1"}class="sub"{/if} href="{node_url}">{node_title}</a>
    {/exp:taxonomy:nav}

    I was surprised to find that didn’t work. 

    What does work is if I change the conditional to use a quoted variable, like so:

    {exp:taxonomy:nav tree_id="{embed:taxonomy_root}" depth="10" display_root="no" ul_css_id="mainmenu"}
      < a {if "{node_level}" != "1"}class="sub"{/if} href="{node_url}">{node_title}</a>
    {/exp:taxonomy:nav}

    However, the FAQ advises against this syntax.


    So, 3 questions:
    1) Do conditionals get parsed differently for add-ons than for the channel module?
    2) Is there some other way that I could write this to accomplish my desired effect?
      2a) Otherwise, is my working code “safe” despite the advice of the FAQ?

  • #2 / Nov 16, 2010 9:15pm

    Lisa Wess

    20502 posts

    Hi, GE -

    This is something you should take up with the author.  Generally speaking, this can be an indicator that the variables aren’t being run through prep_conditionals.

    I’m not familiar enough with this add-on to know if it’s safe; generally, it’s not safe if it’s taking user submitted input, such as URL segments.

  • #3 / Nov 16, 2010 9:24pm

    GoElement

    37 posts

    Thanks for the quick reply.  I’ve posted in the taxonomy thread over in the community forums asking for the author’s input.

  • #4 / Nov 16, 2010 9:27pm

    Lisa Wess

    20502 posts

    Hi, GE - add-on support isn’t handled on our forums.  Iain (the author) will likely ask you to post at his preferred support location, which appears to be on the Devot-ee support forums. =)

  • #5 / Nov 17, 2010 5:29pm

    Lisa Wess

    20502 posts

    Looks like this is fixed in v 1.07.  Please start a new thread if you need anything else!

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases