You are here: Re: The principle of include files in PHP, not as in C++ « PHP Programming Language « IT news, forums, messages
Re: The principle of include files in PHP, not as in C++

Posted by Jerry Stuckle on 10/16/07 00:49

Rik Wasmus wrote:
> On Tue, 16 Oct 2007 01:27:54 +0200, Jerry Stuckle
> <jstucklex@attglobal.net> wrote:
>
>> duzhidian@gmail.com wrote:
>>> On Oct 15, 4:56 pm, Jerry Stuckle <jstuck...@attglobal.net> wrote:
>>>> duzhid...@gmail.com wrote:
>>>>> failed to open stream: No such file or directory
>
> <snip>
>
>>>> Don't use relative paths. Use absolute paths. If you're running this
>>>> under a webserver, you can get to the web server's root with
>>>> $_SERVER['DOCUMENT_ROOT'] and go from there.
>>
>> > If I move the programs to other places, using absolute paths will
>> > suffer, need to change every file.
>> >
>> >
>> (top posting fixed)
>>
>> Not if you use the method I mentioned.
>
> It would cause trouble if he decides to put them somewhere else in the
> tree though....
>
> I usually use this kind of reasoning:
>
> 1. A custom/the main script uses absolute paths from DOCUMENT_ROOT
> 2. Little reusable add-in modules (which could be anywhere) use relative
> paths, but check & store getcwd(), change it to their path, do the file
> action and immediately change it back to the old value.
>
> --Rik Wasmus
>

That's true. But I always use the same format. Included files go below
the website's root directory. Others go in a specific directory in the
root. But there are very few of the latter :-)

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

 

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

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