include() and require() and include_path
| From: | Jennifer | Date: | Sat, 24 Jun 2000 09:59:48 +0000 |
| Subject: | include() and require() and include_path | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-2893@lists.php.net to get a copy of this message | ||
I am very new to PHP. My expereince is in perl.
I have only found a few references to include_path. One mentions that it
can be set with an Apache directive, but I haven't been able to find out
what directive or what the syntax is or where to put it.
Is the include_path path relative to the file that is calling it, relative
to server_root, or document_root or something else?
I set a couple of variables in one file and then required another by HTTP
which prints these varibles and the variables didn't print out. But if I
move all files into the same directory and require just the file, then they
print. I'm just trying to test how everything relates to each other.
This is what I want to do.
My client has a reseller program where everyone has the same pages, but can
customize them to a great degree.
Each page on the reseller sites (which may be under different domain names)
would contain a mimimal amount of code that would never change.
<?php
$iim_id = 'reseller_id';
$url_path = 'index.html';
#my server is set to parse .html as php
require('create_iim.inc');
?>
I want to have one create_iim.inc in a common location.
create_iim.inc would require a couple of files with some basic utilities
that I use over and over again like my MySQL stuff, then connect to the
database and retrieve some specific information about the reseller
including which template he chose.
Then include the file based on his template choice and the url_path. For
exapmle
include("templates/$template/$url_path");
But it seems that I can't specify the path only the file.
The template would also contain more code that would be evaluated and would
depend on what was selected from the database.
How should I go about doing what I want?
Thanks.
Jennifer