|
|
| <prev next> |
Choosing A Webhost: |
Re: root_url and http_host: msg#00000cms.phpslash.devel
On Thu, Dec 19, 2002 at 11:32:57AM -0600, Joe Stewart wrote: > > Mike Gifford and I have been discussing something that I've brought up > before. > > Whether root_url should just be the relative path and not include the full > url. > > In short to paraphrase Mike: > > "Would it just be easier to specify a host: > $_PSL['http_host'] = $_ENV['HTTP_HOST']; > > & have the root url be somthing like this (if it's in a subdirectory of > the site): > $_PSL['rooturl'] = '/public_html';" > I played around with having config.php detect the basedir and rooturl if it is not given in config.ini. This only left the db variables and dir.include. I also played around with setting up variables for the domain name and host name. Worked OK except for the scripts in the admin directory. The rooturl changed and screwed it all up. The rooturl has /admin appended. Then adminurl appends /admin again. Anybody got any good ideas? I sure don't. Joe // basedir -> complete filesystem path to the pages if(empty($_PSL['basedir'])) { $_PSL['basedir'] = getcwd(); } ...skip... // rooturl -> The base URL for the PHPSlash site. if(empty($_PSL['rooturl'])) { $url = parse_url($_SERVER['REQUEST_URI']); $pathinfo = pathinfo($url['path']); $_PSL['rooturl'] = $pathinfo['dirname']; } // root.http_host -> The hostname of the PHPSlash site. if(empty($_PSL['root.http_host'])) { $_PSL['root.http_host'] = $_SERVER['HTTP_HOST']; } // root.domain -> The domain for the PHPSlash site. if(empty($_PSL['root.domain'])) { $server_parts = explode('.', $_PSL['root.http_host']); $count = count($server_parts); if($count > 1) { $_PSL['root.domain.tld'] = $server_parts[$count-1]; $_PSL['root.domain.name'] = $server_parts[$count-2]; $_PSL['root.domain'] = $_PSL['root.domain.name'] .".". $_PSL['root.domain.tld']; unset($server_parts[$count-1]); unset($server_parts[$count-2]); $_PSL['root.domain.host'] = implode('.', $server_parts); } else { // no tld - like localhost $_PSL['root.domain.tld'] = ''; $_PSL['root.domain.name'] = $_PSL['root.http_host']; $_PSL['root.domain'] = $_PSL['root.http_host']; $_PSL['root.domain.host'] = ''; } } > I always just do the rooturl as shown above. There a few templates that I > either have to add the host or {SITE_HOST}. This is how phpslash.org and > phpslash.sf.net generate correct links on one installation. > > Are there still any browser considerations? I believe NS4 will look up > the url again for full urls and not relative. > > Any input? > > Joe > ------------------------------------------------------- This SF.net email is sponsored by: ValueWeb: Dedicated Hosting for just $79/mo with 500 GB of bandwidth! No other company gives more support or power for your dedicated server http://click.atdmt.com/AFF/go/sdnxxaff00300020aff/direct/01/
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Next by Date: | Re: Phpslash-devel digest, Vol 1 #186 - 1 msg, Mike Gifford |
|---|---|
| Next by Thread: | Re: Phpslash-devel digest, Vol 1 #186 - 1 msg, Mike Gifford |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
Free MagazinesCisco NewsReceive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business. subscribe Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field. subscribe The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business. subscribe Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company. subscribe Total Telecom Total Telecom is "The Economist of the communications industry". subscribe |