You are here: Re: PHP Server Paths (Probably OT) « HTML « IT news, forums, messages
Re: PHP Server Paths (Probably OT)

Posted by Toby A Inkster on 02/16/07 09:52

dorayme wrote:

> <?php include ($_SERVER['DOCUMENT_ROOT'].'/includes/footer.inc'); ?>

Unless you're moving files about *a lot*, or you enjoy including files
that include files that include files... just use relative paths. Easy.

<?php include './../../includes/footer.inc'; ?>

Personally, I prefer to create an includes directory, put it wherever the
hell I like (perhaps even outside the document root!) and include files
like this:

<?php include 'footer.inc'; ?>

So how does PHP know where footer.inc is kept? By setting the
"include_path" setting in "php.ini", ".htaccess", "httpd.conf"
or similar. Of course, if you are on shared hosting, you may
need to check that it is possible for you to adjust the
include_path.

--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact
Geek of ~ HTML/SQL/Perl/PHP/Python*/Apache/Linux

* = I'm getting there!

 

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

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