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