Jump to content

[SOLVED] URL Variable in a define statement.


bryweb

Recommended Posts

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

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()}/');

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.