{varname} or
Hi Lodewijk,
I have two quick questions:
- I haven't enabled early parsing at this point and created a global variable, varname.
I'm able to use {varname} in my templates, but {exp:low_variables:parse var="varname"} works as well. Is there any difference, is there extra overhead for the 2nd one for example?
- When I use {exp:low_variables:parse var="varname"} in my templates, the template manager raises a warning:
{exp:low_variables ...
* No closing tag found. Note: some tags do not require closing.
* Please consult the module's documentation if you experience problems.
Is that something I should just ignore?
Thanks!
Leon
Replies
Low 10 Dec 2010 08:04
Hey Leon,
The main difference between {varname} and {exp:low_variables:parse var="varname"} is parse order. Take a look at this parse order cheat sheet.
A. Regular vars like {varname} without early parsing, are parsed ad stage 9.
B. The {exp:low_variables:parse} tags are parsed at stage 5.
C. Vars like {varname} with early parsing are parsed at stage 1.
A would be most efficient. No extra queries, straight forward replacements.
B will add one query to the template process, but only once. Multiple {exp:low_variables:parse} tags will still result in only one extra query.
C will also add one extra query.
In short, there is some overhead for B and C, but it's minimal.
As for the warning; you can safely ignore it. The {exp:low_variables:parse} tag can be both a single tag and a tag pair. I guess the validator doesn't get that.
GWcode 10 Dec 2010 21:28
Ah excellent, thanks for the detailed answer! For this particular example, I'll use A. then. Always good to know what is most efficient.
Saved a copy of the parse order cheat sheet, good stuff :)
Leon