PDA

View Full Version : Using a set of variables through mulitple classes and scripts


2bz2p
12-28-2009, 05:06 PM
Thought is to use a site config class to allow for certain variables to be used throughout the application.

example:
Config class

class {
var $site_url = "flyvang.com";
}


index.php or any other page

require configclass.php

echo $site_url;

//or
function test(){

echo $site_url;

return;
}

test();


So basically I can have a set of variables for the entire application that will flow in and out of pages/functions or methods.

upon my research I found these:

$GLOBALS -- Though couldnt find out how to set each of them??

global $site_url -- Though now I am rewritting global $site_url over and over again

I thought of an array but I am back to the global.

Thanks
2b