bryweb Posted April 16, 2009 Share Posted April 16, 2009 I have a php site that I have multiple domains pointed to one physical directory but I want each domain to use its own template folder, I am using PHP vs. Windows NT S15337964 5.2 build 3790 I have pieced together what I think I need to do, but I am an extreme newbie and need help on how to exactly write it, This is what I got so far. This will be part of the config.php. ------- $url = "http" . ((!empty($_SERVER['HTTPS'])) ? "s" : "") . "://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']; define( 'TEMPLATE_DIR', FULL_PATH . 'templates-$url/' ); define( 'TEMPLATE_C_DIR', FULL_PATH . 'templates_c-$url/' ); ------- I would need to strip the www. out too if it was in the address. Then I would have a template folder for each domain pointing at the site; templates-123.com (or without the .com if possible) templates-abc.com templates-yoursite.com Thanks, Bryan Quote Link to comment https://forums.phpfreaks.com/topic/154311-solved-url-variable-in-a-define-statement/ Share on other sites More sharing options...
bryweb Posted April 17, 2009 Author Share Posted April 17, 2009 Help a NEWBIE, What is wrong with this code, the ECHO command works, why can I not get the DEFINE line to work, THANKS in advance, function curServerName() { return substr($_SERVER["SERVER_NAME"],strrpos($_SERVER["SERVER_NAME"],"://")); } echo "The current page name is ".curServerName(); define( 'TEMPLATE_DIR', FULL_PATH . 'templates/{$curServerName()}/'); Quote Link to comment https://forums.phpfreaks.com/topic/154311-solved-url-variable-in-a-define-statement/#findComment-812015 Share on other sites More sharing options...
premiso Posted April 17, 2009 Share Posted April 17, 2009 define( 'TEMPLATE_DIR', FULL_PATH . 'templates/' . curServerName() . '/'); That would work. You were using a function as a variable. It does not work that way. Quote Link to comment https://forums.phpfreaks.com/topic/154311-solved-url-variable-in-a-define-statement/#findComment-812039 Share on other sites More sharing options...
bryweb Posted April 17, 2009 Author Share Posted April 17, 2009 Thanks Premiso ........That Worked ! ! ! and I actually ended up using the wrong way I did it intially for a variable else where after I got past the hump you got me through. Much Appreciated ! Bryan Quote Link to comment https://forums.phpfreaks.com/topic/154311-solved-url-variable-in-a-define-statement/#findComment-812075 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.