foevah Posted June 3, 2007 Share Posted June 3, 2007 After trying alot of tutorials on breadcrumbs I have found this one the best so far: http://gr0w.com/articles/code/php_breadcrumb_links_creator/ I have got it to work on my home page but when I use it on another page it doesnt work :-\ On my homepage in dreamweaver I have put this php code on my footer because this is where I want my breadcrumbs: <?php $pagetitle="Home"; include("http://www.newmedia.lincoln.ac.uk/jecgardner/breadcrumb.php"); ?> This is inside the included file breadcrumb.php: <?php $ul_id='crumbs'; $bc=explode("/",$_SERVER["PHP_SELF"]); echo '<ul id="'.$ul_id.'"><li><a href="http://www.newmedia.lincoln.ac.uk/jecgardner/">Home</a></li>'; while(list($key,$val)=each($bc)){ $dir=''; if($key > 1){ $n=1; while($n < $key){ $dir.='/'.$bc[$n]; $val=$bc[$n]; $n++; } if($key < count($bc)-1) echo '<li><a href="'.$dir.'">'.$val.'</a></li>'; } } echo '<li>'.$pagetitle.'</li>'; echo '</ul>'; ?> When I view the page source of my homepage in firefox this is the code I see: <ul id="crumbs"><li><a href="http://www.newmedia.lincoln.ac.uk/jecgardner/">Home</a></li><li></li></ul> I am not sure why there are so many </li>? I have put the code below on my contact page: <?php $pagetitle="Contact"; include("http://www.newmedia.lincoln.ac.uk/jecgardner/breadcrumb.php"); ?> When I view the contact page it still says Home and not Home > Contact :-\ :-\ ??? I tried adding a second $pagetitle2: <?php $pagetitle="Home"; $pagetitle2="Contact";include("http://www.newmedia.lincoln.ac.uk/jecgardner/breadcrumb.php"); ?> and in the breadcrumb file I have added this: echo '<li>'.$pagetitle.'</li>'; echo '<li>'.$pagetitle2.'</li>'; Nothing seems to work. I thought this was supposed to be easy lol Please can someone help!? Link to comment https://forums.phpfreaks.com/topic/54110-breadcrumb-help/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.