Thanks for the insight, but I'm not clear on how to implement this. Here is
what I have so far:
?php
switch ($DOCUMENT_URI) {
case '/home/globalhemp/www/':
include(/home/globalhemp/www/includes/apple.inc);
break;
case '/home/globalhemp/www/Archives/':
include(/home/globalhemp/www/includes/quicktime.inc);
break;
case '/home/globalhemp/www/Archives/Essays/':
include(/home/globalhemp/www/includes/quicktime_download.inc);
break;
}
?
Perhaps $DOCUMENT_URI is not correct...perhaps it should be $PATH_INFO? Or
should I have some sort of return or print statement?
TEST URL: http://globalhemp.phpwebhosting.com/switch.php
Thanks,
Eric C. Pollitt, Founder
401 E. Illinois Ave.
Peoria, IL 61603
Global Hemp - Portal to the hemp community
http://www.globalhemp.com/
Hemp is of first necessity to commerce and marine, in other words, to the
wealth and protection of the country.
-- Thomas Jefferson
From: Marek Kilimajer [EMAIL PROTECTED]
Date: Wed, 18 Sep 2002 10:59:46 +0200
To: PHP [EMAIL PROTECTED]
Subject: Re: [PHP] Conditionally include file based on document location
switch($DOCUMENT_URI) {
case '/':
include( watch you want);
break;
case
}
Eric C. Pollitt wrote:
I would like to know how to conditionally included a file based on the
document location.
The purpose is for placement of location-specific navigation menus.
I'm not interested in DHTML hierarchical drop-down menus, rather inserting
ready made HTML files using perhaps (?) DOCUMENT_URI (?) and error checking
logic.
EXAMPLE
If DOCUMENT_URI is / (home) then the following file included:
URL: http://www.globalhemp.com/includes/apple.html
If DOCUMENT_URI is /quicktime/ then the following file included:
URL: http://www.globalhemp.com/includes/quicktime.html
If DOCUMENT_URI is /quicktime/download/ then the following file included:
URL: http://www.globalhemp.com/includes/quicktime_download.html
The error checking logic would be for child directories that don't have
their own include file and thus would use a parent directory include file.
If a parent directory file doesn't exist, it would include the top-level
(home) include file.
The closest PHP example that I have found thus far follows:
[INCOMPLETE] PHP CONDITIONAL INCLUDE EXAMPLE
Extracted from: http://www.jwweb.com/20010629.html
?php
if ($location == quicktime) {
include(quicktime.inc);
if ($location == quicktime/download) {
include(download.inc);
} else {
include(home.inc);
}
?
THANKS!
Eric C. Pollitt, Founder
401 E. Illinois Ave.
Peoria, IL 61603
Global Hemp - Portal to the hemp community
http://www.globalhemp.com/
Create like a god. Command like a king. Work like a slave!
-- Constantin Brancusi
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php