breadcrumbs? (Was: URL parsing)

From: Date: Sat, 24 Mar 2001 04:13:29 +0000
Subject: breadcrumbs? (Was: URL parsing)
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-45402@lists.php.net to get a copy of this message
could someone check this? From the URL parsing discussions, you should be able to do these two things with a URL like this: index.php/main/default/sitelevel1/sitelevel2/sitelevel3/name.html 1. set some page variables from the URL: function page_init() { global $REQUEST_URI; global $init_vars[]; //array set in config file, eg. //$init_vars[]="$tpl"; //$init_vars[]="$stylesheet"; $path_array = explode('/', $REQUEST_URI); while (list ($init_key,$init_value) = each($init_var[])) { list($uri_key, $uri_value) = each($path_array[]) $init_value = uri_value } } 2. create a you-are-here thingy like: sitelevel1 >> sitelevel2 >> sitelevel3 >> name.html function breadcrumbs() { global $REQUEST_URI global $init_depth; //how much of initial uri items to discard $path_array = explode('/', $REQUEST_URI); for ($i=0, $i <= $init_depth; $i++); { array_shift($path_array); //discard config item - not used here } $page_name = array_pop($path_array); //strip page name from end of array $crumbs_length = count($page_array); //how long is path now? $crumbs_div = " >> "; //use to divide the breadcrumbs for ($i=0, $i <= $crumbs_length; $i++); { list($position, $value) = each($path_array); echo $value; echo $crumb_div; } echo($pagename); } now, anyone have any idea how to make each sitelevel item an href??? regards, jaxon

« previous php.general (#45402) next »