Ok, I have two templates:
site/index
site/internal
Both of these templates include an embed:
_network_embeds/.network-footer
This embed has two user defined global variables:
{footer_strapline}
{contact_telephone}
Now, If I use site/index for a page at uri “/” then the global variables are not parsed. IF I use site/index for a page at any other uri, e.g., “/test”, “/some/thing” then they do get parsed out. If I use the site/internal template for these pages the same thing happens. No parsing for “/” anything else is parsed out as expected. This lead me to believe something isn’t happening at “/”.
So, after digging around and debugging core.template.php specifically the function “parse_globals()” I, regrettably for my own sanity, find that the function is being called for both “/” and any other uri. Hmm… what could be going on.
I put several breakpoints throughout the function and it is definitely being called in it’s entirety, so no redirects or other early returns are happening.
And then, I see something. The query to fetch the user defined global variables:
$query = $DB->query("SELECT variable_name, variable_data FROM exp_global_variables
WHERE site_id = '".$DB->escape_str($PREFS->ini('site_id'))."'
AND user_blog_id = '".$DB->escape_str($ub_id)."' ");In both circumstances (uri “/” and uri “/anything”) the exact same query is produced:
“/”
string(123) "SELECT variable_name, variable_data FROM exp_global_variables WHERE site_id = '1' AND user_blog_id = '0' "“/anything”
string(123) "SELECT variable_name, variable_data FROM exp_global_variables WHERE site_id = '1' AND user_blog_id = '0' "Here’s the killer, the query at “/” returns no variables. The query at “/anything” returns the expected variables…
What the hell?