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. Link to comment https://forums.phpfreaks.com/topic/263765-simple-breadcrumbs-for-website/ 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? Link to comment https://forums.phpfreaks.com/topic/263765-simple-breadcrumbs-for-website/#findComment-1351672 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. Link to comment https://forums.phpfreaks.com/topic/263765-simple-breadcrumbs-for-website/#findComment-1351928 Share on other sites More sharing options...
AibZilla Posted June 7, 2012 Author Share Posted June 7, 2012 Bump, can anyone solve this? Link to comment https://forums.phpfreaks.com/topic/263765-simple-breadcrumbs-for-website/#findComment-1351986 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.