Reply to Re: Relative paths and include files

Your name:

Reply:


Posted by Fairul Izham on 07/18/05 06:44

if you include all file to index.php you must using absolute path to access
any file in your structure.

for example if you put include("header.php") in index.php that's mean you
writing the header.php code in index.php file. So if you want to access
image1.gif , you must access it from images/image1.gif because you access it
from index.php.

p/s: corret me wrong

"mark" <mark@something.com> wrote in message
news:dber1t$j9d$1@nwrdmz01.dmz.ncs.ea.ibs-infra.bt.com...
>I am designing a website at the moment and looking at the difference
>between relative and absolute url links which is driving me crazy! I would
>like to use relative paths, but it is proving very restrictive as to how I
>design the file structure when it comes to including files. I currently
>have something like below:
>
> folder1
> folder2
> images
> ---image1.gif
> includes
> ---header.php
> ---footer.php
> folder3
> ---folder4
> ---file0.php
> ---file1.php
> ---file2.php
> index.php
>
>
> I am currently thinking I will have to run all my scripts at the same
> level to ensure I can include the header.php file in all my pages while
> maintaining the integrity of links in the header.php. For example, if I
> include header.php in index.php and header.php is referencing
> ../images/image1.gif in the images folder, the link will no longer be
> valid when included in index.php. Does that make sense?
>
> Can anybody share some tips on what they do to overcome what must be a
> very common problem? Is absolute paths the answer so instead of calling
> ../images/image.gif from the include file, I would call
> /images/image1.gif?
>
> Any help that anybody can give me would be much appreciated.
>
> Thanks,
> Mark.

[Back to original 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

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