ccsnet Posted August 22, 2007 Share Posted August 22, 2007 Hi, I'm making a move from html to php and have come accross a couple of issues.... the main one I have is refrencing some files. Normally I would use.... <head> <base href="http://letscommunicate.co.uk"> </head> at the top of each page how ever my php pages ( some where written by another person have have been proven to work ) dont like them and error. I did find a more advance version on the net which is as follows and I'd perfer to use. <head> <base href="http://<?php if(($_SERVER['HTTP_HOST'])=='localhost'){ echo'localhost/'; } else { echo'www.traffic.letscommunicate.co.uk/'; } echo $_SERVER['REQUEST_URI'] ?>" /> </head> Some of the php pages will be called by a CRON job so I guess the html commands will be of no use so I've got to find a 'pure' php equivelent. The reason I beleive I need to do this is because I think by using '/folder/file.ext' its going to the root of the virtual server of my host rather than the root of my domain. Any advice or suggestions would be much apprciated as I have to apply this against all my pages so looking for an easy way to do it.... may be a config.php file some where which I can include ???? ( not sure how to do that just read some thing some where ). Thanks Terran Quote Link to comment https://forums.phpfreaks.com/topic/66185-base-href-and-a-pure-php-equiv/ Share on other sites More sharing options...
lemmin Posted August 22, 2007 Share Posted August 22, 2007 I think this is what you are looking for: http://us3.php.net/manual/en/function.chroot.php Quote Link to comment https://forums.phpfreaks.com/topic/66185-base-href-and-a-pure-php-equiv/#findComment-331043 Share on other sites More sharing options...
trq Posted August 22, 2007 Share Posted August 22, 2007 I think this is what you are looking for: http://us3.php.net/manual/en/function.chroot.php Not at all. You might want to take a look at $_SERVER['DOCUMENT_ROOT']. Quote Link to comment https://forums.phpfreaks.com/topic/66185-base-href-and-a-pure-php-equiv/#findComment-331060 Share on other sites More sharing options...
lemmin Posted August 22, 2007 Share Posted August 22, 2007 Woops, sorry about that. It said "Change the root directory"! Quote Link to comment https://forums.phpfreaks.com/topic/66185-base-href-and-a-pure-php-equiv/#findComment-331066 Share on other sites More sharing options...
trq Posted August 22, 2007 Share Posted August 22, 2007 Woops, sorry about that. It said "Change the root directory"! Yeah, but its to be used within a cli context. Quote Link to comment https://forums.phpfreaks.com/topic/66185-base-href-and-a-pure-php-equiv/#findComment-331077 Share on other sites More sharing options...
ccsnet Posted August 22, 2007 Author Share Posted August 22, 2007 I've found some info here ( http://uk3.php.net/reserved.variables ) which I'll have to go through but just to check... is $_SERVER['DOCUMENT_ROOT']. A read only command... or could I use it as in.... require("$_SERVER/includes/db.inc.php"); ? ( Its the /includes/db.inc.php file I'm having probs with seeing due to I think it looking at the 'server' root and not the domain root. ) Terran Quote Link to comment https://forums.phpfreaks.com/topic/66185-base-href-and-a-pure-php-equiv/#findComment-331130 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.