Re: Absolute or relative paths



Within plain HTML if you start a URL with "/" that refers to the root
level of the domain and your absolute URL will be good. For example,

<img src="/images/myFile.gif" />

should work no matter where it's used.

However everything's different within PHP code. If want to refer to an
absolute path inside of <? and ?> then you need to use a different
strategy. One thing that works is to precede your absolute path with
"$_SERVER['DOCUMENT_ROOT'] like this:

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

.



Relevant Pages

  • Re: Urgent: Help needed Behavior of Sun Linker and loader
    ... >includes a header and which refers to a function as an absolute ... The header gives a extern declaration of function. ... >assuming that the runtime loader does relocation as SUN manual says ...
    (comp.sys.sun.misc)
  • Re: Determine if path is absolute or relative
    ... even a simple file name could be called an absolute path.] ... It was you having a Q, Anthony, not me. ... size of the universe you are working in. ... Web Application I would call the path /mydir/subir/ an absolute path ...
    (microsoft.public.scripting.jscript)
  • Re: require_once() ... gone mad? !
    ... I am passing the fully qualified (i.e. absolute pathname) to a file that exists on my machine. ... I suspect you're missing the 'www' part in the absolute path. ... Now temporarily looking for some smaller PHP/MySQL projects/work to fund a self developed bigger project, mail me at rik at rwasmus.nl. ...
    (comp.lang.php)
  • hyperlinks - absolute path refuses to stay!!!!
    ... disk and run it off the disk, meaning any relative paths will not ... an absolute path into a hyperlink in excel is to manually go and look ... I know you can set a 'hyperlink base address' for all hyperlinks in the ...
    (microsoft.public.excel.misc)
  • Re: .pth files in working directory
    ... > absolute path of top is. ... If top/ is the working directory for your Python interpreter, ...
    (comp.lang.python)