This is a discussion on breadcrumb classes. within the PHP Language forums, part of the PHP Programming Forums category; I am looking for a breadcrumb class in PHP that does not rely on the directory structure to build the ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
I am looking for a breadcrumb class in PHP that does not rely on the
directory structure to build the trail. I have been using Richard Baskettes - http://www.baskettcase.com/classes/breadcrumb/ - breadcrumb classes and they are great... BUT. I have a site that is being built using templates and the directory hierarchy can not be used to create the trail. Sorry if you read this post in alt.lang.php. Thanks. |
|
|||
|
Is a class really needed for breadcrumbs? For my blog navigation (my
weblog script) I simply just use a function that goes along with my template engine. Example: <?php $output = breadcrumb("{b Index}index.php{/b} {s} {b Options}index.php?options{/b}", "||"); function breadcrumb($data,$sep) { $breadcrumb = str_replace("{s}", $sep, $data); $breadcrumb = preg_replace("#{b (.*?)}(.*?){/b}#s", "<a href=\"\\2\">\\1</a>", $breadcrumb); return $breadcrumb; } print($output); ?> Will create a simple breadcrum setup, and you could just display the navigation depending on the page load (example): $output = breadcrumb("{b ".$_GET['id']."}index.php?id=".$_GET['id']."{/b}", "||"); Depends on how advanced you want to get. |