EE Insider Tips
Sponsored by Mijingo's EE 2 Screencasts
ExpressionEngine mini-howtos created by the EE Insider community.
Use custom global variables in your templates
While you can use sub-templates to contain common elements of your design (e.g., header, footer), you can also use custom global variables. For example, I often create a global variable called “analytics” that contains my Google Analytics code, and I insert this global variable throughout my template.
This way, if I need to update my analytics code, I simply update the global variable and my entire site is updated.
Note that global variables can only contain static content (i.e., HTML, CSS, JavaScript). They cannot contain EE template tags or PHP code.
Email
Print
Post to Twitter
Post to Delicious
Add Your Comment?
You must have an EE Insider account to post comments on Insider Tips. It's fast, easy and hassle-free.
Sign up now (or login).