xiao Posted April 19, 2008 Share Posted April 19, 2008 I currently use something like this: config.php <?php /** * @author Sander Quirynen * @copyright IPCS.be */ # Language //ID of... $instT = "1"; index.php ... require ("config.php"); ... But I get an error on my index.php saying Notice: Undefined variable: instT in C:\xampp\htdocs\pcconfig\index.php on line 128 I include the file on line 8... Quote Link to comment Share on other sites More sharing options...
xiao Posted April 19, 2008 Author Share Posted April 19, 2008 Fixed it. I was trying to use those variables inside functions ' Is there maybe a better way besides using 'global $...' everytime I need sth in a function? I don't really want to use session variables either since I already use like 30 of those. Quote Link to comment Share on other sites More sharing options...
ToonMariner Posted April 19, 2008 Share Posted April 19, 2008 IMO you should NOT use variables as configuration settings - instead use constants; after all configuration settings are constants... My config files take the guise of... <?php define ( 'SETTING1' , 'setting1value'); // comment on constants meaning ?> the beauty of using constants over variables lies in the memory use involved - constants are more efficient. Quote Link to comment Share on other sites More sharing options...
xiao Posted April 20, 2008 Author Share Posted April 20, 2008 and how do you use constants? :$ Quote Link to comment Share on other sites More sharing options...
tippy_102 Posted April 20, 2008 Share Posted April 20, 2008 and how do you use constants? :$ Here is the information on using constants: http://ca.php.net/constants Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.