Hi there -
Some of my navigation has siblings (my db is setup as 'auto_id', 'name', 'parent', and 'text') and I've setup my navigation and content so that there is no text for a parent if it has siblings. I've modified the 'text' query to default to the 1st sibling's text when a parent is clicked. For example, if the parent is 'link A' and it has siblings of 'sub link 1' and 'sub link 2', when the user clicks on 'link A', the text for 'sub link 1' displays. This works fine.
However, I need to modify the breadcrumb code to do the same and I can't figure out how to do it. Below is the current breadcrumb code:
function bread_crumb($id) {
$sql = "SELECT *
FROM nav_and_content
WHERE auto_id = $id";
$query = mysql_query($sql);
if($query) {
$row = mysql_fetch_assoc($query);
$id = $row[0];
$name = $row[1];
if($row['parent'] == 0){
return '<a href="content.php?id=' . $row['auto_id'] . '">' . $row['name'] . '</a>';
}
else{
return bread_crumb($row['parent']) . ' > ' . '<a href="content.php?id=' . $row['auto_id'] . '">' . $row['name'] . '</a>';
}
}
return FALSE;
}
$breadcrumbtrail = bread_crumb("$id");
print("<a href=\"index.php\">Home</a> > $breadcrumbtrail");
Thanks in advance for your help!