You are here: Re: Relative path & php « PHP Language « IT news, forums, messages
Re: Relative path & php

Posted by AF on 07/08/05 02:46

On Thu, 7 Jul 2005 19:40:31 +0200, "Hilarion"
<hilarion@SPAM.op.SMIECI.pl> wrote:

snip

>Another cause could be wrapping URL parameters as fragments
>of path, eg.:
>http://some.domain.com/some_path/some_script.php/param1/param2
>In this case "some_script.php" in "some_path" is generating
>output HTML, but all URLs will be relative to virtual path
>http://some.domain.com/some_path/some_script.php/param1/param2
>
>
>
>In the example above the easiest solution would be to change
>relative path to the image file to server absolute path
>(you do not have to provide Internet absolute path, which
>means including protocol name and server name):
><img src="/some_image.gif" />
>or (in the second case):
><img src="/sub/some_image.gif" />
>It'll also work in case of path-wrapped parameters.
>
>
>Hilarion

Thanks for the post.

I am using the format you mention of:

>http://some.domain.com/some_path/some_script.php/param1/param2

I think I have tried your suggestion, although I am not sure I follow
you paragraph above. I have taken my code shown below

<img src="library_files/logo.gif" alt="Mortgage Loans" border="0"
width="128" height="122"></a><br><br></td>
<a href="index.html"><font size="1">Home</font></a></p>

and added a ../ so that it now read

<img src="../library_files/logo.gif" alt="Mortgage Loans"
border="0"
width="128" height="122"></a><br><br></td>
<a href="index.html"><font size="1">Home</font></a></p>

library_files is a directory right under the root dir, and index.html
is in the root.

I am still not sure what you mean though. Could you take the code I
show above and change the root to how you think it will work?

I am lost on what is the server absolute path. And depending on what
you mean is there a way to change the directory paths programatically
without out having to rewrite my original code?

PS I know how to fill in a php variable and pt the variable in front
to create a correct path, as in

<?

$URL = "http://www.domain.com/";

?>

<img src="<? echo $URL; ?>library_files/logo.gif" alt="Mortgage
Loans" border="0"
width="128" height="122"></a><br><br></td>
<a href="<? echo $URL; ?>index.html"><font
size="1">Home</font></a></p>

I jsut would prefer to change or set the path at the beginning of a
file rather than have to add the code to every file and link.

Again thanks for all of the post.

 

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

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