CodeIgniter Forums
Global Variables in Templates - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21)
+--- Thread: Global Variables in Templates (/showthread.php?tid=8637)



Global Variables in Templates - El Forum - 05-25-2008

[eluser]Lucas3677[/eluser]
I'm trying to implement simple global variables within my view files, so that when someone creates a template they can just type {site_owner} or {admin_email} and have it replaced by the correct value at run-time.

My first instinct tells me that I should create a hook at display_override and just replace the strings there. Is there a better way to do this?


Global Variables in Templates - El Forum - 05-25-2008

[eluser]gtech[/eluser]
have you looked at the parser class?

[url="http://ellislab.com/codeigniter/user-guide/libraries/parser.html"]http://ellislab.com/codeigniter/user-guide/libraries/parser.html[/url]