Jump to content

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

 

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.