ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

User defined global vars... weird...

July 10, 2009 9:54am

Subscribe [1]
  • #1 / Jul 10, 2009 9:54am

    Daniel Walton

    553 posts

    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?

  • #2 / Jul 10, 2009 10:17am

    Daniel Walton

    553 posts

    Ok, close this mofo down. Had a stale cache file :/

  • #3 / Jul 10, 2009 10:18am

    Ingmar

    29245 posts

    Ah, the joys of caching… Thanks for letting us know 😊 If you need further help, simply start a new thread, please.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases