vbnullchar Posted October 10, 2006 Share Posted October 10, 2006 anyone has a bread crumb script? that can make something like this [code]PHP Freaks Forums >> PHP and MySQL >> PHP Help >> Start new topic[/code] Quote Link to comment https://forums.phpfreaks.com/topic/23517-bread-crumb-navigation/ Share on other sites More sharing options...
HuggieBear Posted October 10, 2006 Share Posted October 10, 2006 There's a couple of nice ones here:[url=http://www.hotscripts.com]Hotscripts[/url]RegardsHuggie Quote Link to comment https://forums.phpfreaks.com/topic/23517-bread-crumb-navigation/#findComment-106706 Share on other sites More sharing options...
vbnullchar Posted October 10, 2006 Author Share Posted October 10, 2006 i got 2 hits but they're not the one im looking for Quote Link to comment https://forums.phpfreaks.com/topic/23517-bread-crumb-navigation/#findComment-106715 Share on other sites More sharing options...
HuggieBear Posted October 10, 2006 Share Posted October 10, 2006 Did you try this one, it's advanced and has lots of configurable options...http://www.baskettcase.com/classes/breadcrumb/If it's not what you're after, perhaps a better explanation is in order?RegardsHuggie Quote Link to comment https://forums.phpfreaks.com/topic/23517-bread-crumb-navigation/#findComment-106716 Share on other sites More sharing options...
vbnullchar Posted October 10, 2006 Author Share Posted October 10, 2006 still no. I wanted to create a navigation similar to this, where you can just click the previous level PHP Freaks Forums > PHP and MySQL > PHP Help > bread crumb navigation Quote Link to comment https://forums.phpfreaks.com/topic/23517-bread-crumb-navigation/#findComment-106734 Share on other sites More sharing options...
GremlinP1R Posted October 10, 2006 Share Posted October 10, 2006 There you go hope it will help you<?php $id = $_GET['id']; if ( strlen( $id ) < 1 ) $id = "home"; $pages = array( home => array( id=>"home", parent=>"", title=>"Home", url=>"showpage.php?id=home" ), users => array( id=>"users", parent=>"home", title=>"Users", url=>"showpage.php?id=users" ), jack => array( id=>"jack", parent=>"users", title=>"Jack", url=>"showpage.php?id=jack" ) ); function breadcrumbs( $id, $pages ) { $bcl = array( ); $pageid = $id; while( strlen( $pageid ) > 0 ) { $bcl[] = $pageid; $pageid = $pages[ $pageid ]['parent']; } for( $i = count( $bcl ) - 1; $i >= 0; $i-- ) { $page = $pages[$bcl[$i]]; if ( $i > 0 ) { echo( "<a href=\"" ); echo( $page['url'] ); echo( "\">" ); } echo( $page['title'] ); if ( $i > 0 ) { echo( "</a> | " ); } } } ?> <html> <head> <title>Page - <?php echo( $id ); ?></title> </head> <body> Breadcrumbs: <?php breadcrumbs( $id, $pages ); ?><br/> Page name: <?php echo( $id ); ?> </body> </html> Quote Link to comment https://forums.phpfreaks.com/topic/23517-bread-crumb-navigation/#findComment-106740 Share on other sites More sharing options...
HuggieBear Posted October 10, 2006 Share Posted October 10, 2006 [quote author=vbnullchar link=topic=111046.msg449746#msg449746 date=1160477889]still no. I wanted to create a navigation similar to this, where you can just click the previous level PHP Freaks Forums > PHP and MySQL > PHP Help > bread crumb navigation[/quote]OK, I don't know if you didn't read the page where I sent you or just didn't understand, but the link I posted was to some code for breadcrumb navigation that allows you to click the previous levels. There were even over 25 examples when showing the different options with the code.I think I'm going to have to bail out of this one, good luck with finding what you're afterRegardsHuggie Quote Link to comment https://forums.phpfreaks.com/topic/23517-bread-crumb-navigation/#findComment-106746 Share on other sites More sharing options...
Daniel0 Posted October 10, 2006 Share Posted October 10, 2006 Store the bread crumbs in an array like this: [code]$nav[] = array('Main page','index.php');$nav[] = array('Some other page','index.php?page=some_other');$nav[] = array('Yet another page');[/code]Then when generating the bread crumbs do this: [code]<?phpforeach($nav as $bc){ $nav2[] = empty($bc[1]) ? $bc[0] : "<a href='{$bc[1]}'>{$bc[0]}</a>";}echo "<div id='bread_crumbs'>".join(' > ',$nav2)."</div>";?>[/code] Quote Link to comment https://forums.phpfreaks.com/topic/23517-bread-crumb-navigation/#findComment-106789 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.