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.

Global Variables Question

October 31, 2011 5:01pm

Subscribe [3]
  • #1 / Oct 31, 2011 5:01pm

    stefan1

    8 posts

    Is it possible to get more control over my global variables white space?

    The indentation of their includes gets knocked all whack when i view page source?
    Am I able to edit them as text files the same as the template files?

    On the same note, should I be using a global variable in the same what I would use a PHP/ASP include?

    For example to include my main nav on every page?

  • #2 / Oct 31, 2011 7:53pm

    ralph.m

    225 posts

    Is it possible to get more control over my global variables white space?

    The indentation of their includes gets knocked all whack when i view page source?

    Just leave any whitespace that would have been there in the original template. They drop into your template just as they are. So paste in the variable code just as it would be in the template - with tabs etc.

    Am I able to edit them as text files the same as the template files?

    No, but you can if you use a program like Mountee (but it’s only for Mac).

    On the same note, should I be using a global variable in the same what I would use a PHP/ASP include?

    You have three options: use a global variable, a snippet or an embed. Use the global variable if the code is just html/css/js. Use a snippet if there there are basic EE tags in the code, and use an embed is you have channel tags etc that need to be processed. (That’s a really basic and inaccurate summary of each. See the docs for more precise info.)

     

  • #3 / Oct 31, 2011 8:12pm

    stefan1

    8 posts

    wow great reply thanks a lot.
    This mountee looks nice but ill leave that for another day.

    thanks for describing the three options, I didnt even know there was a third.

  • #4 / Nov 01, 2011 4:29pm

    John St-Amand

    865 posts

    You can use channel tags in snippets too - I’m getting more in the habit of using them in place of spots where I had previously used embeds.  One of the main differences between them that’s worth noting is that you can pass a variable through to an embed for use in the embedded template - you can’t do that with a snippet.

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

ExpressionEngine News!

#eecms, #events, #releases