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.

why does EE parse Template Global Variables last?

July 13, 2007 7:00pm

Subscribe [3]
  • #1 / Jul 13, 2007 7:00pm

    Michael Rog

    179 posts

    An architectural question for the EE folks:

    It seems to me that it would be useful if template global variables could be used as parameters in EE tags… and it would make sense that since they are among the least “dynamic” elements one could put in a template (at least that’s my perception), they should be among the first things to get parsed.

    But, I’m yall have probably considered that, but still decided to parse them last. So I’m curious: why?

  • #2 / Jul 13, 2007 8:26pm

    Derek Jones

    7561 posts

    There are other variables designed for the purpose you are looking for, Mike, both path.php globals and dynamically assigned globals.  Since Template Globals are derived from the database, from a performance perspective, it makes much more sense to parse them at the very end.  A given page might call 1, 5, 10, or 100 templates.  If we parsed Template Globals early on, that’s one time for each template.  By waiting until the very end, after all tags and embeds have been parsed, we can replace all occurrences in the output in one fell swoop.

  • #3 / Jul 15, 2007 5:56pm

    Michael Rog

    179 posts

    ah… as I expected, that logic makes perfect sense.

    I’ve been playing around with path.php globals, which are amazingly useful for pulling blog content into subdomains…

    I’ve never seen dynamically assigned globals mentioned anywhere… where can I find more info about them?

  • #4 / Jul 16, 2007 12:06am

    Derek Jones

    7561 posts

    Right here, Mike. :-D

  • #5 / Jul 16, 2007 1:51am

    Michael Rog

    179 posts

    Ah, I didn’t realize normal template variables were called “global” also… (my newbishness is showing…)

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

ExpressionEngine News!

#eecms, #events, #releases