AibZilla Posted June 6, 2012 Share Posted June 6, 2012 Hi, was wondering if anyone has a decent breadcrumb link that is simple and possibly step by step? I've googled php breadcrumbs and most of them I don't understand or they don't work, If anyone has personal favorites or a particularly simple way to implement breadcrumbs into a website please help me out, thanks. Quote Link to comment Share on other sites More sharing options...
Jessica Posted June 6, 2012 Share Posted June 6, 2012 It will have to be specific to your site, that is the sort of thing you have to write the code for rather than copy from an example. What don't you understand about what you've read? Quote Link to comment Share on other sites More sharing options...
AibZilla Posted June 7, 2012 Author Share Posted June 7, 2012 I actually sort of figured it out but now I have a specific problem.. here is some code <?php require('includes/crumb-brains.php'); $crumbMonster = new Crumbs (); $breadcrumbs = '<a href="index.php">Home<a>'; switch ($_SERVER['PHP_SELF']) { case '/update-list.php': $newCrumbListLabel = $crumbMonster->GetCrumbUpListLabelByListID($_GET["listid"]); $breadcrumbs .= ' » '. $newCrumbListLabel; break; case '/view-list.php': $newCrumbListLabel = $crumbMonster->GetCrumbListLabelByListID($_GET["listid"]); $breadcrumbs .= ' » '. $newCrumbListLabel; break; case '/update-item.php': $newCrumbUpItemLabel = $crumbMonster->GetCrumbUpItemLabelByItemID($_GET["itemid"]); $breadcrumbs .= ' » <a href="view-list.php?listid=">Items<a> » '. $newCrumbUpItemLabel; break; } echo $breadcrumbs; ?> The last case ('/update-item.php') I want the <a href="view-list.php?listid="> to get my list label and post it for the breadcrumb before the $newCrumbUpItemLabel Here is my functions for better understanding. <?php class Crumbs { private $crumbs = array(); private $mysql; private $database; function __construct(){ $this->mysql = mysql_connect('localhost','root',''); if (!$this->mysql) { echo 'no connection'; } $this->database = mysql_select_db('toitdoit',$this->mysql); } public function GetCrumbListLabelByListID($listId) { $sql = "SELECT `ListLabel` FROM `lists` WHERE `ListId` = ".$listId." LIMIT 0,30"; $result = mysql_query($sql); if (!$result) { die('Invalid query: ' . mysql_error()); } $labels = mysql_fetch_array($result, MYSQL_ASSOC); return $labels['ListLabel']; } public function GetCrumbUpListLabelByListID($listId) { $sql = "SELECT `ListLabel` FROM `lists` WHERE `ListId` = ".$listId." LIMIT 0,30"; $result = mysql_query($sql); if (!$result) { die('Invalid query: ' . mysql_error()); } $labels = mysql_fetch_array($result, MYSQL_ASSOC); return $labels['ListLabel']; } public function GetCrumbUpItemLabelByItemID($itemId) { $sql = "SELECT `ItemLabel` FROM `items` WHERE `ItemId` = ".$itemId." LIMIT 0,30"; $result = mysql_query($sql); if (!$result) { die('Invalid query: ' . mysql_error()); } $labels = mysql_fetch_array($result, MYSQL_ASSOC); return $labels['ItemLabel']; } } ?> Thanks in advance if you can help. Quote Link to comment Share on other sites More sharing options...
AibZilla Posted June 7, 2012 Author Share Posted June 7, 2012 Bump, can anyone solve this? Quote Link to comment 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.