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.

embed tag rendering in simple conditional and I can't stop it

March 26, 2012 3:00pm

Subscribe [2]
  • #1 / Mar 26, 2012 3:00pm

    wondermade

    53 posts

    I’m trying to do something like:

    {if segment_2 ==''}
     do thing 1
    {/if}
    {if segment_2 !=''}
     {complex conditional}
      {embed}
     {/if}
    {/if}

    Even when segment_2 is blank, the embed tag is processing per the debugging tool. But according to the documentation that should only happen if I’m using complex conditionals, right? I need to stop that because the performance hit is messing up our load time and in some cases running us out of memory.

    Thanks for any help!

  • #2 / Mar 26, 2012 3:41pm

    Andrew Fairlie

    126 posts

    Hi there Wondermade,

    Not sure if this will fix it, but it seems like you could achieve what you’ve done in 2 if-statements in 1, and that may prove to be more efficient in itself.

    {if segment_2 ==''}
     do thing 1
    {if:else}
     {complex conditional}
      {embed}
     {/if}
    {/if}
  • #3 / Mar 26, 2012 3:53pm

    wondermade

    53 posts

    Well, I can’t use if:else without becoming a complex conditional.
    Perhaps a more legit capture of my problem would be:

    {if segment_2 ==''}
       do complex series of stuff that requires memory
    {/if}
    {if segment_2 !=''}
     {complex conditional}
       do different complex series of stuff that requires memory
     {/if}
    {/if}

    I don’t want to render tags for a failed conditional. But right now in my pages like this every tag is rendering. I’ve done a lot of the inline performance boosting, but I can’t achieve any savings as great as just skipping the unneeded tags.

  • #4 / Mar 27, 2012 3:47pm

    Dan Decker

    7338 posts

    Hi wondermade,

    I’m sorry you are bumping into unnecessary parsing!

    Can you supply the full template code that is calling the embed? It’s easier to troubleshoot the big picture than simple example in some cases.

    If the code is too large for the forums, feel free to link to a post on paste.org

    Cheers,

  • #5 / Mar 27, 2012 4:01pm

    Dan Decker

    7338 posts

    Hi wondermade,

    Quick update here, even trying to trap the advance conditional bits inside a simple conditional will result in an advanced conditional. Reading through the Parse Order and User Guide, I get the sense that embed templates will be processed regardless.

    I’d still like a look at the overall picture to see if we can come up with a solution that gets you the performance you are after.

    Cheers,

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

ExpressionEngine News!

#eecms, #events, #releases