FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » relative v. absolute paths
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
relative v. absolute paths [message #173275] Fri, 01 April 2011 05:28 Go to previous message
Evolution is currently offline  Evolution
Messages: 14
Registered: April 2011
Karma:
Junior Member
I have a php file that when I include it from my homepage, I specify:

require_once './library/php/head.php';

head.php itself includes another php file in the middle of its text:

require_once './library/php/javascript.php';

That works and is all well and good.

However, if I then try to use head.php from other php files in
subdirectories, then the path to javascript.php is no longer valid and
fails.

If I were to specify an absolute path to javascript.php, it should
work from any other location.

I'm a beginner at PHP so I have always abided by the idea that all php
files should be included with a relative path. Is this always true?

If so, is there a better way to do this? Thanks a bunch.
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: browser time
Next Topic: writing php scripts for fastcgi environments
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Fri Sep 20 13:19:22 GMT 2024

Total time taken to generate the page: 0.05389 seconds