Fadion Posted September 2, 2007 Share Posted September 2, 2007 I am making a website for a client with a simple php/mysql custom cms. The problem i am facing is when using constants. They cant seem to work. Ex: I have a config.php file where i put all the configuration constants define('SITE_TITLE', 'My Webiste'); When echoing SITE_TITLE locally i get 'My Website' but on the shared host i just get 'SITE_TITLE' echoing. I can fix those by using variables but i would need to change a lot of code. Has anybody else faced this problem and if so how did u fix it? Thanks in advance. Link to comment https://forums.phpfreaks.com/topic/67660-solved-constants-problem/ Share on other sites More sharing options...
wildteen88 Posted September 2, 2007 Share Posted September 2, 2007 How are you echo'ing the constant? Make sure you don't wrap the constant in quotes eg: echo 'SITE_TITLE'; // OR echo "SITE_TITLE"; The constant has to be on its own eg: echo SITE_TITLE; Prehaps check to see if the constant SITE_TITLE is defined first before using it: if (defined('SITE_TITLE')) { echo SITE_TITLE; } else { echo "'SITE_TITLE' does not exist"; } Link to comment https://forums.phpfreaks.com/topic/67660-solved-constants-problem/#findComment-339863 Share on other sites More sharing options...
Fadion Posted September 2, 2007 Author Share Posted September 2, 2007 Oh how dumb. I had a file changed locally which i didnt upload and it was there where i included the config file. Thnx wildteen for the fast reply and for giving the right direction in debugging. Link to comment https://forums.phpfreaks.com/topic/67660-solved-constants-problem/#findComment-339870 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.