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.

Best approach to solve this issue?

July 01, 2010 5:58pm

Subscribe [2]
  • #1 / Jul 01, 2010 5:58pm

    twhed

    6 posts

    Using EE2.0, I’m trying to figure out what the best approach is to including/embeding a config file at the beginning of a template.  For example, in my index file I might have:

    {embed="shell/config"}
    {embed="shell/header"}
    some content
    <?php echo $var_from_config_file; ?>
    more content
    {embed="shell/footer"}

    Within shell/config I have a bunch of variables, constants, functions, whatever defined to be used in other files.

    Will this work at all?  I can’t seem to access vars defined in config from index, even if I global them.  If I define it in index before the shell/config embed, and then try to access the var in config, it works fine, but not as I have it above.

    Is there a better solution for this?  I absolutely need to be able to embed/include a config file at the top of each page.  Ideally I’d even just put it in the header file but I’m trying to keep it simple for the sake of the example.

  • #2 / Jul 01, 2010 6:15pm

    Wouter Vervloet

    758 posts

    Hi thwed,

    You can’t access variables across templates as far as I know because of the way EE parses them.

    I think you’re better of using Low Variables for this… it gives you complete freedom of what to include in a template and specify the parsing order accordingly.

    Greetz,
    Wouter

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

ExpressionEngine News!

#eecms, #events, #releases