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

Support archive

Nesting Low Variables within Low Variables Failing

Lea Alcantara 23 Feb 2012 02:46 problem, complete

When my client was on EE 2.2 and an older version of Low Variables, I was able to nest early parsed low variables within each other.

So, for example, I'd have a {sidebar} variable and in that would be HTML text including two other low variables inside it with conditionals. Then, I upgraded to EE 2.4 and the latest Low Variables (2.0.3) and what I had before no longer worked.

I tried to troubleshoot various ways, but in the end, I ended up copy-pasting the other low variables raw content into {sidebar} -- and the content I was asking for loaded as expected.

Now, this isn't too bad, since just putting everything into one variable worked, but it's also sort of sad because I wanted to have certain snippets of code separated for easier updating (ie instead of scrolling a giant sidebar text box of code).

Help?

Replies

  1. Low 23 Feb 2012 09:16

    Hey Lea,

    Nesting early parsed vars is tricky business. Before the version 2.0.3, there was no predefined order in which the early parsed Low Variables (EPLV) were dealt with, so basically, if it worked, then that's just lucky. :)

    As of LV 2.0.3, the EPLV are added to the native Snippets array (and thus parsed) in the order they appear in their group (actually, first by group ID, then by order in the group). This means you have more control over which EPLV are parsed before others.

    In your example, you could have a group called Snippets, containing 3 EPLV, say {sidebar}, {sidebar_content_1} and {sidebar_content_2}. If you want to put the latter two in the first one, you'll have to make sure the order of the vars in the group is this:

    * sidebar
    * sidebar_content_1
    * sidebar_content_2

    Then it will work. An order like this will not work:

    * sidebar_content_1
    * sidebar_content_2
    * sidebar

    If you're nesting variables across groups, I'd recommend putting them in the same group to have more control over the order in which the EPLV are parsed.

    Hope that helps.

  2. Lea Alcantara 23 Feb 2012 16:00

    Ohhhh... thank you for this. I'm glad this was explained. :) Is this in the docs somewhere?

  3. Low 24 Feb 2012 07:56

    I gave it a mention in the changelog, but I guess it deserves a paragraph in the docs somewhere. :)