low variables pre parse issue since update
EE v2.5.5 - Build Date: 20121220
Low Variables: 2.3.2
EngineHosting PHP: 5.3.2
I've done an update and a load of LV code that was working before the update is no longer working. It seems to be due to things that are preparsed. Previous version of EE was 2.4.0 and LV 2.0.3. All the variables are set to early parsing and were working before the update.
This code was in a template:
{if "{exp:low_variables:parse var='site1:lv_ticket-link'}" != ""}{exp:low_variables:parse var='site1:lv_ticket-text'}{/if}
This code is in a snippet, (but seems to work when in a template):
{exp:channel:entries channel="shows" entry_id="24" limit="1" status="{fv_showstatus}" dynamic="no" disable="categories|member_data|pagination"}
{title}
{/exp:channel:entries}
Any ideas what i'm doing wrong? I guess it must be a parsing issue but I dont understand why this worked before the update and not now...
Replies
Low 16 Jan 2013 14:38
What's the error message you're getting?
Joobs 16 Jan 2013 14:49
where would that error message be?
LV seems to be working, i can access the module pages. But on the front end in the templates some values are no longer getting parsed early.
In the second example, with the code in the snippet.
If the snippet has just {lv_showstatus} on it's own, it displays "open|closed"
but then if i put that in the paramaters of a channels loop.
{exp:channel:entries channel="shows" entry_id="24" status="{lv_showstatus}" dynamic="no"}{title}{/exp:channel:entries}
the channel returns no_results, persumably because lv_showstatus isn't getting parsed early enough anymore since the update?
Low 16 Jan 2013 14:54
So, is the first conditional working as before?
As for the fv_showstatus-var, that's in a Snippet, outside of LV?
Joobs 16 Jan 2013 15:10
I think it's easier if we ignore the first conditional example and just focus on the second one for now.
{lv_showstatus} - is a low variable, text input with early parsing (in my first post i mislabled it fv_showstatus). It has text open|closed as it's value.
This code is inside a snippet:
{exp:channel:entries channel="shows" entry_id="24" status="{lv_showstatus}" dynamic="no"}{title}{/exp:channel:entries}
and returns no results.
However the same code in a normal template seems to return {title} correctly. So it could be something to do with the parsing order of snippets and early parsed LVs?
Low 16 Jan 2013 15:14
Yeah, most likely. If you turn on template debugging, you can see the "snippet array" keys and values. That is the order in which they are parsed. Also, that isn't really something I can influence with LV.
As a workaround, you could use preload replace vars (explained here), or put the snippet in a LV as well, and use either the "killing the embed method", or use the order in the LV group to control the parse order even more.
Joobs 16 Jan 2013 15:32
Has something changed in EE or LV that's changed the parse order? This was all working on a production site before without any issues but i hasn't been updated in nearly a year. Looking at the change log LV 2.1 added "For EE 2.4+, early parsed vars will be added to the Snippet array using the new template_fetch_template hook", would that have had a change?
Another question:
{exp:low_variables:parse var='lv_ticket-link'} - that parses correctly giving some text.
{exp:low_variables:parse var='site1:lv_ticket-link'} - when i define the site it comes back blank?
Low 16 Jan 2013 15:41
It could affect it, yes.
You could also try and open up ext.low_variables.php in a text editor, and look up these lines:
...then uncomment the top line and comment out the bottom one.
I'll look into the MSM issue now.
Low 16 Jan 2013 15:55
Can you turn on template debugging and show me what the Low Variables lines say?
Joobs 16 Jan 2013 17:07
These lines?
I've realised something, this only seem to not work if the site you're specifying is the same as the site you are viewing. So this is the behavior, site1 has variable lv_test with a value of "this is site1", site2 has a variable also called lv_test with a value of "this is site2":
Viewing site1, call site1:lv_test = blank
Viewing site1, call site2:lv_test = displays text "this is site2"
site2 uses a lot of templates from site1 (via embeds), so this is why my template code specifies the site.
Low 16 Jan 2013 17:39
Ah yes, I can replicate now. I'll get that fixed for the next version.
Are you able to work around it, or do you need a patched file?
Joobs 16 Jan 2013 18:41
Thanks for your help today.
A patched file would be useful if it's not too much trouble.
Low 16 Jan 2013 19:32
For a quick fix, try opening up mod.low_variables.php in a text editor. Then go to line 391 and remove the following code from the if-statement: