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.

passing an embed variable not going through

October 06, 2010 12:23pm

Subscribe [3]
  • #1 / Oct 06, 2010 12:23pm

    gmatoso

    5 posts

    Hello, I’m working with taxonomy, but my question is not directly related to Taxonomy but rather the embed feature in EE.

    Basically, I’m embedding a template as shown here: http://iain.co.nz/taxonomy/tags/get_children_ids.html

    the main code that’s not working is this:

    {embed='global_embeds/sub_menu_tabs' entry_ids='{exp:taxonomy:get_children_ids tree_id="1" entry_id="{entry_id}"}'}

    when I pass a simple word like “test” it does fine. And when I simply print out the code…

    {exp:taxonomy:get_children_ids tree_id="1" entry_id="{entry_id}"}

    it also displays correctly the string. But when I take that code and pass it into the embed variable, it doesn’t go through. It comes out in the embedded template as blank.

    What I have to do to get it working is enable PHP on the template and pass it in like this…

    <?php
        $taxonomy_children_ids = "{exp:taxonomy:get_children_ids tree_id='2' entry_id='{entry_id}'}";
    ?>
    {embed="global_embeds/sub_menu_tabs" entry_ids="<?php echo $taxonomy_children_ids ?>"}


    Which seems very odd, I’d rather not have to enable PHP if I don’t really have to.

  • #2 / Oct 06, 2010 5:56pm

    Ingmar

    29245 posts

    It’s a parse order issue. Basically you’re triple-nesting (entry_id with in taxonomy as a parameter for embed) and that won’t work. A PHP solution might be your best option here.

  • #3 / Oct 10, 2010 10:05pm

    iain

    317 posts

    Hi gmatoso,

    I’ve recently come across this too, I haven’t had time to investigate but I found a fix to be calling the tag in a comment just above your embed tag, like so

    <!-- {exp:taxonomy:get_children_ids tree_id="1" entry_id="{entry_id}"} -->
    {embed='global_embeds/sub_menu_tabs' entry_ids='{exp:taxonomy:get_children_ids tree_id="1" entry_id="{entry_id}"}'}

    the tag output gets put into a session variable the first time, meaning the second instance is recieved from there, and voila.

    Like I said, my time is really limited right now but I have begun the rewrite for Taxonomy 1.0,  I’ll see what I can do about a better fix long term.

  • #4 / Oct 11, 2010 3:56pm

    Ingmar

    29245 posts

    Thank for sharing this with us, iain. Closing this one, please post again in case there’s anything else. Thanks.

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

ExpressionEngine News!

#eecms, #events, #releases