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

Support archive

Variable not parsed when used in a snippet

Russ Back 18 Mar 2011 15:52 question, complete

Hi Low

Just started using Variables so apologies if this is a new brainer. I have a template that calls in a snippet. This snippet contains the following:


{embed="includes/.panels" ids="{lv-under-one-roof-panel-set}"}


When the page is rendered, the embed variable ids has not been parsed despite the fact that I have this particular variable set to parse early.

Here's how I see it in debug mode:

(0.068544) Embed Variables (Keys): ids
(0.068551) Embed Variables (Values): {lv-under-one-roof-panel-set}
(0.068592) Parse Date Format String Constants
(0.068605) Parse Current Time Variables
(0.068631) Parsing Segment, Embed, and Global Vars Conditionals
(0.069009) - Beginning Tag Processing -
(0.069027) Parsing Tags in Template
(0.069075) Tag: {exp:channel:entries channel="panels" disable="member_data|pagination|trackbacks|categories|category_fields" status="open" dynamic="off" fixed_order="{lv-under-one-roof-panel-set}"}
(0.069134) Closing Tag Found
(0.069166) Processing Tags

etc....

Is this expected behaviour?

Replies

  1. Low 18 Mar 2011 16:05

    Hey Russ,

    Early parsed variables are equal to snippets, in the sense that they are added to the snippet array. In fact, they are added to that array before the actual snippets themselves are added to them. This is something I cannot control. This also means early parsed Low Variables cannot be parsed inside snippets.

    You can work around it, tho. Try using the template tags instead of the variable in your snippet:

    {exp:low_variables:parse var="lv-under-one-roof-panel-set"}{embed="includes/.panels" ids="{value}"}{/exp:low_variables:parse}

  2. Russ Back 18 Mar 2011 16:39

    Thanks Low

    I'm now seeing this though - the {value} isn't parsed?:

    {exp:channel:entries channel="panels" disable="member_data|pagination|trackbacks|categories|category_fields" status="open" dynamic="off" fixed_order="{value}"}

  3. Low 18 Mar 2011 16:50

    Let's see here, does this work?

    {exp:low_variables:parse var="lv-under-one-roof-panel-set"}{embed="includes/.panels" ids="{lv-under-one-roof-panel-set}"}{/exp:low_variables:parse}

  4. Russ Back 18 Mar 2011 17:01

    That's done it. Thanks Low, that's awesome.