How do you include a file based on a fragmented URL?

From: Date: Fri, 04 Oct 2002 01:49:03 +0000
Subject: How do you include a file based on a fragmented URL?
Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-6095@lists.php.net to get a copy of this message
Hello all, I finally figured out how to create a URL-specific conditional include (see code below). However, I would like to know if anyone can give me any pointers on how to include a file based on a fragmented URL. For example, the following code will include the file "quicktime.inc" for ../Archives/index.html but not for ../Archives/some_file.html or ../Archives/yet_another_file.html Therefore, I would like to know how to make this work for all "children" of the "parent" directory ../Archives. Furthermore, in the case of their being a child directory with its own include, it should use that include file instead. For example, the following code will include the file "quicktime.inc" for ../Archives/index.html and include the file "quicktime_download.inc" for ../Archives/Essays/index.html AND ../Archives/Essays/some_file.html AND ../Archives/Essays/yet_another_file.html {php} $PHP_SELF = $_SERVER['PHP_SELF']; switch ($PHP_SELF) { case '/index.html': include ("/home/globalhemp/www/includes/apple.inc"); break; case '/Archives/index.html': include ("/home/globalhemp/www/includes/quicktime.inc"); break; case '/Archives/Essays/index.html': include ("/home/globalhemp/www/includes/quicktime_download.inc"); break; default: include ("/home/globalhemp/www/includes/apple.inc"); break; } {/php} THANKS! Eric C. Pollitt, Founder 401 E. Illinois Ave. Peoria, IL 61603 Global Hemp - Portal to the hemp community http://www.globalhemp.com/ Never doubt that a small group of thoughtfully committed citizens can change the world. Indeed, it's the only thing that ever has. -- Margaret Mead

« previous php.smarty.general (#6095) next »