Forum Moderators: coopster

Message Too Old, No Replies

include's directory set with .htaccess

making includes omni present

         

Storyman

8:06 am on Nov 21, 2004 (gmt 0)

10+ Year Member



There is a sub-directory for the includes. Things go smoothly with all of the files in the root directory. However, when files from sub-directories use includes things sometimes go haywire. For example, the header.inc.php calls the stylesheet from styles/main.css. That is fine as long as the calling file is in the root directory. Obviously it doesn't work if called from a sub-directory.

Someone mentioned that they thought there is a way to use .htaccess to setup the inlcudes folder so no matter which sub-directory the includes is called from it will always know where to find it.

If that is true is it also applicable to setting up the styles directory? That way it won't matter which sub-directory the request is bing made from.

Salsa

2:14 pm on Nov 21, 2004 (gmt 0)

10+ Year Member



Storyman, what if you use the full path to /styles/main.css? Also, you can set an include path in php.ini.

Storyman

4:28 pm on Nov 21, 2004 (gmt 0)

10+ Year Member



Salsa,

It took me a minute to realize what you meant, i.e.:
include( $_SERVER['DOCUMENT_ROOT'] . '/includes/master.inc.php' );

Good suggestion.

coopster

2:27 pm on Nov 22, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Have a look at Control your included files in the latest Bag 'o Tricks [webmasterworld.com] thread.