You are here: RE: [PHP] include() problem « PHP « IT news, forums, messages
RE: [PHP] include() problem

Posted by "Dan Parry" on 01/09/06 17:48

Check this out

http://uk2.php.net/reserved.variables

DOCUMENT_ROOT will give you the root of your site

-----Original Message-----
From: Nuno Trancoso [mailto:erazerpt@gmail.com]
Sent: 09 January 2006 14:56
To: php-general@lists.php.net
Subject: [PHP] include() problem

This may sound dumb, but i have been up all night going through
php/apache docs, and still have not found an answer..

Throughout a site i need to include files that are scattered in subdirs,
sometimes up in the dir tree, sometimes down. Bad design i know but i
have to live w/ it...

Problem is in the way Apache/PHP see stuff. If i include /somefile.htm
in html, it means somefile.htm wich is at site root dir. In PHP it looks
like it means somefile.htm at SERVER root dir.

I can use getcwd() and go around truncating/adding to the string until i
get a path to use with set_include_path() to add the site root dir to
the include path, but it just seems wrong to waste cycles doing it...

So, question is, is there a more direct/elegant way to add the site root
(or any other dir for that matter) to the include path?

TIA
Nuno Trancoso

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

__________ NOD32 1.1356 (20060108) Information __________

This message was checked by NOD32 antivirus system.
http://www.eset.com

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация