Jump to content


Photo

php includes


  • Please log in to reply
4 replies to this topic

#1 black.horizons

black.horizons
  • Members
  • PipPipPip
  • Advanced Member
  • 78 posts

Posted 28 September 2006 - 03:27 PM

do included files assume the directory position of the file from which they're included.

e.g.
website/includes/header.php - has links to ../index.htm

a file links.php resides in
website/links.php

if links.php includes /includes/header.php

with a link to index.htm, will the link work, or not?

#2 HuggieBear

HuggieBear
  • Members
  • PipPipPip
  • Advanced Member
  • 1,899 posts
  • LocationEngland, UK

Posted 28 September 2006 - 03:31 PM

It's a simple enough test to try :)

But yes, relevant to the calling doc, not the included doc I believe.

Regards
Huggie
Advice to MySQL users: Get phpMyAdmin and test your queries work there first, take half the hassle out of diagnosis, also check the reserved words list.

Links: PHP Docs :: RegEx's :: MySQL :: DevGuru :: w3schools

#3 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 28 September 2006 - 03:33 PM

The included files become part of the file including them.

So if you included header.php from the includes folder into links.php which is in the website folder then all paths from header.php go from the website folder and not the lincludes folder.

#4 black.horizons

black.horizons
  • Members
  • PipPipPip
  • Advanced Member
  • 78 posts

Posted 28 September 2006 - 03:39 PM

thats what i thought, just i have a lot of sub folders, so for the subfolders i'll have to modify the header.php, and add an extra ../ to every a href. not so bad, unless there's something else i can do?

#5 hopeless

hopeless
  • New Members
  • Pip
  • Newbie
  • 8 posts

Posted 29 September 2006 - 01:03 AM

Setting the absolute path at the top of every page seems to work for us - we then just have all inlcudes in one folder (same with scripts etc) and it yanks them out and works out he path.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users