You are here: Re: directory paths...how does this work? « PHP Programming Language « IT news, forums, messages
Re: directory paths...how does this work?

Posted by Tim Van Wassenhove on 10/07/13 11:36

On 2006-01-06, John K <kinane3@yahoo.com> wrote:
> My problem is in asp I can reference this file from any
> folder/directory. For example, if I were here.... "/admin/default.asp"
> I could reference the include as is. In php I can't do this, at least
> I don't know how to. Another problem is that if there are file paths
> in the include itself this problem comes up again. I know I could
> write this <?php include "../menu.php"?> and it would find it's way to
> the file but what about the file paths in the include? This is a menu
> with relative paths to images.

PHP has a configuration setting include_path.
Apart from setting it in php.ini you can also change it at runtime
(http://www.php.net/ini_set).
And you can manipulate it with http://www.php.net/get_include_path and
http://www.php.net/set_include_path

The only problem you might experience is that paths are separated with ; on
windows platforms and with : on unix platforms. To avoid this i suggest you take
an approach as following:

$include_paths = array('.', '..', '/var/somewhere' , get_include_path());
ini_set('include_path', implode(PATH_SEPARATOR, $include_paths));


--
Met vriendelijke groeten,
Tim Van Wassenhove <http://timvw.madoka.be>

 

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

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