Declaring global varibles

Get help with installation and running phpBB 3.0.x here. Please do not post bug reports, feature requests, or MOD-related questions here.
Get Involved
Forum rules
END OF SUPPORT: 1 January 2017 (announcement)
Registered User
Posts: 23
Joined: Sat Jul 05, 2008 5:52 am

Declaring global varibles

Post by numerical25 » Mon Jul 07, 2008 3:10 am

Im trying to declare varibles in the data_global.php page so i can throw some php into templates. My problem is I declare the variblle like this 'varible' => 'hello world', and then i throw it in the page like this {varible} . When i view it, it doesnt appear. i tried clearing the cache but it still doesnt work. but if a modify a previous existing varbile like sitename. the changes take effect. how do i make it where phpbb recognizes my newly declared varibles ?

User avatar
Former Team Member
Posts: 6559
Joined: Mon Mar 21, 2005 6:57 pm

Re: Declaring global varibles

Post by ameeck » Mon Jul 07, 2008 7:14 am

data_global.php is only a cache file which contains preparsed data from the scripts.

You declare the template variables in other places. If you want to be able to use the variable on all pages, you declare it in includes/functions.php, in the page_header() function. If you want to use it only on a specific page, declare it in that page's PHP file.

Look for $template->assign_vars(. This might also be a good resource to start with:


Return to “[3.0.x] Support Forum”