Jump to content

breadcrumb help


foevah

Recommended Posts

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.