Config Global Vars not parsed in search results
I have somewhat of a weird problem. I'm using Focus Lab's Master Config to configure EE. I'm setting some global variables in there whose values are Low Variable tags.
Everything is parsed perfectly across the site, except on our Low Search results page. On that page, the global vars aren't even parsed, so we're getting tags such as {global:google_analytics} showing up at the bottom of our page.
Does Low Search handle things differently relative to the parse order? Is what I'm trying to do possible? I thought I had it working at one point, though I'm not sure what might have changed since.
Thanks!
Replies
Low 2 Nov 2014 09:52
Low Search is a module like any other, and its tags are parsed normally. What does template debugger tell you?
Tommy Sanchez 4 Nov 2014 01:28
Thanks for the reply! I was just combing through the template debugger output for my Low Search results page, and the global variables (set in the config) are being interpreted properly. But EE is outputting the global variable tags themselves instead of parsing their values. I should note that these GV tags are in a low variable called using the "single" tag.
In another test, I removed all page elements for the search results and just tried outputting the GVs directly, outside of a LV, and that is working.
Sorry if this is so confusing. I'm having a hard time explaining things. Hopefully it's making a little sense.
Let me know if you have any other thoughts/ideas or other things I can look into to help with debugging.
Thanks for your time!
Low 4 Nov 2014 07:55
How are you outputting the GVs elsewhere? Is that in a LV single tag, too? Or directly?
Tommy Sanchez 4 Nov 2014 08:06
They are all output in the same LV across the site. It contains all the "page close" stuff, like scripts, closing divs and body/html tags, etc.
Here's an excerpt. The tags in question are the "{global:...}" ones.
{!-- Footer --}
{exp:low_variables:single var="lv-devsnippet-footer"}
{!-- JS --}
{lv-global-js}
{!-- Extra JS paths here --}
{if include_js}
{include_js}
{/if}
{global:add_this}
{global:google_analytics}
{global:munchkin_scripts}
{lv-global-html_end}
Low 4 Nov 2014 08:08
I'll need to take a look myself. Please send SuperAdmin login credentials to hi at gotolow dot com if you can.
Tommy Sanchez 4 Nov 2014 23:56
Sure thing...I needed to get approval. I'll have that over shortly.
Low 6 Nov 2014 09:01
For visibility:
I managed to solve it. It was a parse order issue. The {global:...} vars are parsed early, before tags, and aren’t parsed again later on in the template engine. You were using the :single tag to parse the footer, which means the {global:...} vars were already parsed but only then hit the template, leaving them unparsed.
Enabling early parsing on the lv-inc-page_close var and using the variable syntax solved the issue.
Tommy Sanchez 6 Nov 2014 18:48
Thanks again! That was a huge help.