create a default path
Moderator: General Moderators
-
bladecatcher
- Forum Commoner
- Posts: 67
- Joined: Sat Mar 12, 2005 12:50 am
create a default path
G'day All,
Sorry if this is the wrong place.
I somehow want to have a set path to a directory. So in my php code I can refer to say "include($mydir_path . "header.php")" in any script from any directory.
Can I set a permanent global variable $mydir_path = /var/www/mysite/mydir or is there a better way?
Thanking you in anticipation,
bladecatcher
btw, perhaps it can be set in apache??? that would be good? or php.ini etc???
Sorry if this is the wrong place.
I somehow want to have a set path to a directory. So in my php code I can refer to say "include($mydir_path . "header.php")" in any script from any directory.
Can I set a permanent global variable $mydir_path = /var/www/mysite/mydir or is there a better way?
Thanking you in anticipation,
bladecatcher
btw, perhaps it can be set in apache??? that would be good? or php.ini etc???
-
bladecatcher
- Forum Commoner
- Posts: 67
- Joined: Sat Mar 12, 2005 12:50 am
include_path
G'day Pyrite,
Thank you for your reply.
I've done a bit of a search which turned up "http://au.php.net/manual/en/function.se ... e-path.php" (the User Contributed Notes are interesting) but let me get this right.
If I rename the relevant scripts I want to "include" to .inc and put them in the "inc" directory then edit php.ini to:
; UNIX: "/path1:/path2"
;include_path = ".:/php/includes"
include_path "/var/www/inc"
php will then prepend that path to *all* .inc files?
tia
bladecatcher
Thank you for your reply.
I've done a bit of a search which turned up "http://au.php.net/manual/en/function.se ... e-path.php" (the User Contributed Notes are interesting) but let me get this right.
If I rename the relevant scripts I want to "include" to .inc and put them in the "inc" directory then edit php.ini to:
; UNIX: "/path1:/path2"
;include_path = ".:/php/includes"
include_path "/var/www/inc"
php will then prepend that path to *all* .inc files?
tia
bladecatcher
-
bladecatcher
- Forum Commoner
- Posts: 67
- Joined: Sat Mar 12, 2005 12:50 am
Thanks feyd.
My thought train was hijacked by an poor article that suggested to me that include_path was just for .inc files.
So if php can't find the file (any file) in the current dir, it searches through the include_path.
Can I somehow use that directive in apache's httpd.conf file? perhaps in a <VirtualHost *>
listing?
thanking you in advance,
bladecatcher
My thought train was hijacked by an poor article that suggested to me that include_path was just for .inc files.
So if php can't find the file (any file) in the current dir, it searches through the include_path.
Can I somehow use that directive in apache's httpd.conf file? perhaps in a <VirtualHost *>
listing?
thanking you in advance,
bladecatcher
- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
yes, read up on how to change php configuration in httpd.conf :: http://php.net/configuration.changes
-
bladecatcher
- Forum Commoner
- Posts: 67
- Joined: Sat Mar 12, 2005 12:50 am
-
bladecatcher
- Forum Commoner
- Posts: 67
- Joined: Sat Mar 12, 2005 12:50 am
include_path recursive
G'day All,
Is there a way of making the include_path recursive. (i.e look in sub-directories)?
Thanking you in anticipation,
bladecatcher
Is there a way of making the include_path recursive. (i.e look in sub-directories)?
Thanking you in anticipation,
bladecatcher
-
bladecatcher
- Forum Commoner
- Posts: 67
- Joined: Sat Mar 12, 2005 12:50 am
G'day feyd,
Thank you, you've been particularly helpful (and patient) to me. Your taking the time to pass on your considerable knowledge is greatly appreciated.
Both relative and absolute paths have their own draw backs depending on the situation.
I'm currently stewing over how best to construct my site as your probably aware. Decisions I make now could save or create a lot of pain further down the track.
For a number of reasons I'm splitting the site up using named subdomains, those links (between) will be absolute others absolute to the server (/var/www/xyz/page.html) others relative.
I'm thinking about having a link building include so that links do not require updating (a labourious task).
Has there been discussion on this? If so could you give me a hint on a search criteria please?
and ... I think you've answered my question.
and ... do you have any comment on my earlier .inc file question?
Thanking you once again,
bladecatcher
Thank you, you've been particularly helpful (and patient) to me. Your taking the time to pass on your considerable knowledge is greatly appreciated.
Both relative and absolute paths have their own draw backs depending on the situation.
I'm currently stewing over how best to construct my site as your probably aware. Decisions I make now could save or create a lot of pain further down the track.
For a number of reasons I'm splitting the site up using named subdomains, those links (between) will be absolute others absolute to the server (/var/www/xyz/page.html) others relative.
I'm thinking about having a link building include so that links do not require updating (a labourious task).
Has there been discussion on this? If so could you give me a hint on a search criteria please?
and ... I think you've answered my question.
and ... do you have any comment on my earlier .inc file question?
Thanking you once again,
bladecatcher
-
bladecatcher
- Forum Commoner
- Posts: 67
- Joined: Sat Mar 12, 2005 12:50 am