Agreed - use absolute paths - but DONT include the protocol://server
Best is:
  <A HREF=/admin/mypage>
Not so good is:
  <A HREF=/admin/mypage.php>
  <A HREF=/admin/mypage.html>
Don't do this
  <A HREF=http://www.mine.com/admin/mypage>
          ^^^^^^^^^^^^^^^^^^^
You don't want your dev site linking to unreleased pages
in production etc.

I wanted relative, but after probs with web design tools, php and
having loads of sites to maintain I eventually had to bite the bullet
and now use absolute paths for all links. There are too many gotchas
balancing a tree of relative links.

Note that w3, recommend NOT include the file type in the link.
Let the server choose it for you: e.g.
  <A HREF=/admin/mypage>
is better than than
  <A HREF=/admin/mypage.php>
  <A HREF=/admin/mypage.html>
etc.

A nice side effect is that you can start with static holding .html
pages and transparently substitute them, a page at a time to smarter
.php as you get the coding done.

Of course, you need a decent web server...


Regards
Jeff

-----Original Message-----
From: Matt Williams [mailto:[EMAIL PROTECTED]]
Sent: Monday, March 19, 2001 1:23 PM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: RE: [PHP] site root variable (for Generic Unix and Windows)



you could make your links absolute
ie..

/cat.html

so if you're in http://green/admin/admin.html

you would link to

http://green/cats.html

HTH

M@
> I am developing a PHP site under windows which is going to be deployed
> eventually on Unix (indeed when life gets less hectic will also
> be developed
> under Unix but that's another story).
>
> Anyway the header.html (included at top of every page) has links in it.
> However depending where the page is which is including
> header.html the links
> (from a relative point of view) will be different.  For example for the
> index.php (which is in site root) the catalogue page is simply referred to
> as cat.html but from admin.html (which is in the admin directory
> under site
> root) ../cat.html would be required.
>
> A way to get round this problem seems to be to have a variable
> with the site
> root in it (i.e. $siteroot = "c:/pages/") however this is causing
> me a real
> headache.  using
>
>   echo "<a href=\"" . $siteroot "/cat.php">Catalogue</a>
>
> renders href to c:/pages/cat.php but then the browser tries to
> download the
> page as a file.  I have also tried
>
> $siteroot = "http://green/
>
> (green being the domain) but this douse not work either.
>
> I would really like the solution to this to be platform independent.
>
> Ta in Advance,
> ben
> --
> [EMAIL PROTECTED] (ben@work until end March)
> [EMAIL PROTECTED] (ben@home)
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to