Jim Macdiarmid wrote:

I seem to be having trouble with including files into my pages. I like
to structure my site into folders so that I can keep the root folder
relatively clean and only necessary files go in there. For example:

\DocRoot\
        \folder1\
        \folder2\
        \folder3\
        -- etc --

include("..\folder1\includefile.php");
Or just include("\folder1\includefile.php");

but that doesn't seem to help. Is there an easier way to this?


Thanks a bunch, Jim

Check out your php.ini, the directive called include_path. But realize that if you do it this way and plan to take your code to another machine then you will have to change this ini directive on the new machine.


One other option is to create a common.php file in your DocRoot that gets included in every file and sets the docroot. See http://www.php.net/manual/en/function.dirname.php

--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to