Nested varibles?
I have a Path.php varible called "lang" and it's value is "default".
I have a Low Variables called {template_branding} which contains....
< div id="branding" >
< h1 >< a href="{path=SITE_INDEX}" >{{lang}_sitename}< /a >< /h1 >
</ div >
I have another low variable called {default_sitename} with contains the name of my site.
{template_branding} output is....
< div id="branding" >
< h1 ><a href="http://mysite.org" >{default_sitename}< /a >< /h1 >
< /div >
Instead of....
< div id="branding" >
< h1 >< a href="http://mysite.org" >My Sitename< /a >< /h1 >
< /div >
I know it's a parsing order issue and i've been playing about with different orders but can't get anything to work. Is it possible?
Replies
robin 21 Jan 2010 14:53
This forum ate all my html. i've added spaces to stop it.
Low 21 Jan 2010 15:22
You're right, this is parsing order. Path.php variables are parsed first, then Low Variables with Early Parsing, then Low Variables without early parsing.
However, you can swap the first two around:
- Open ext.low_variables_ext.php in a text editor
- On line #215, you'll see this:
$IN->global_vars = array_merge($IN->global_vars, $early);
- Change that to:
$IN->global_vars = array_merge($early, $IN->global_vars);
Now Low Variables with Early Parsing are parsed first, then Path.php vars.
I'll do some checking to see if I can make this a setting of some sort.
robin 21 Jan 2010 15:30
Great, that works!
Thanks again low. I'll definitely be purchasing more of this module after i've completed my template.
Thanks.