Starfox2007
Mitglied
Hier das fertige Script falls es mal einer braucht :
Viel Spaß damit
PHP:
$sql= "SELECT id FROM (SELECT @id AS id, @id := IF(@id IS NOT NULL, (SELECT parent FROM tabelle WHERE id = @id), NULL) AS parent FROM tabelle, (SELECT @id := '$pageId') AS vars WHERE @id IS NOT NULL) AS dat";
$result = mysql_query($sql);
while ($breadcrumb = mysql_fetch_array($result))
{
$breadid[] = $breadcrumb["id"];
}
asort($breadid);
$breadid = implode(",", $breadid);
$counter = 1;
$sql2 = "SELECT id, label, link FROM tabelle WHERE id IN ($breadid)";
$result2 = mysql_query($sql2);
$num_rows = mysql_num_rows($result2);
while ($breadcrumb = mysql_fetch_array($result2))
{
if($breadcrumb["id"] == "1") { // Wenn Hauptseite soll nichts weiter angezeigt werden.
echo "";
}
if($counter == $num_rows) {
echo "<a href='index.php?page=".$breadcrumb["link"]."'>".$breadcrumb["label"]."</a>";
}else{
if($counter > 1) {
echo "<a href='index.php?page=".$breadcrumb["link"]."'>".$breadcrumb["label"]."</a> <img src='./images/hpstyle/menue/arrow.gif' style='vertical-align:middle;' alt='' title='' /> ";
}else{
echo "<a href='index.php?page=news'>Hauptseite</a> <img src='./images/hpstyle/menue/arrow.gif' style='vertical-align:middle;' alt='' title='' /> <a href='index.php?page=".$breadcrumb["link"]."'>".$breadcrumb["label"]."</a> <img src='./images/hpstyle/menue/arrow.gif' style='vertical-align:middle;' alt='' title='' /> ";
}
}
$counter++;
}
Viel Spaß damit