Jump to content

merrickdav

New Members
  • Posts

    4
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

merrickdav's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I have find a php class for breadcrumb navigation but I'm unsure how to use it. Any ideas? <?php /* * Breadcrumb navigation class * Mick Sear * http://www.ecreate.co.uk * * The key to using this is to decide on a $level for each page. (array, starting position 0) * This determines where in the trail a link will be placed. So, I normally make the homepage level 0, * then every page that can be accessed from the top level nav becomes level 1, and every page * from that second level becomes level 2, and so on. When users return to a higher level (e.g. level 1) * the surplus links are removed. Only one page can occupy a $level in the crumb trail. * There might be several routes to a page. In which case, the trail will reflect the route that the * user actually took to get to that page. */ class Breadcrumb{ var $output; var $crumbs = array(); var $location; /* * Constructor */ function Breadcrumb(){ if ($_SESSION['breadcrumb'] != null){ $this->crumbs = $_SESSION['breadcrumb']; } } /* * Add a crumb to the trail: * @param $label - The string to display * @param $url - The url underlying the label * @param $level - The level of this link. * */ function add($label, $url, $level){ $crumb = array(); $crumb['label'] = $label; $crumb['url'] = $url; if ($crumb['label'] != null && $crumb['url'] != null && isset($level)){ while(count($this->crumbs) > $level){ array_pop($this->crumbs); //prune until we reach the $level we've allocated to this page } if (!isset($this->crumbs[0]) && $level > 0){ //If there's no session data yet, assume a homepage link $this->crumbs[0]['url'] = "/index.php"; $this->crumbs[0]['label'] = "Home"; } $this->crumbs[$level] = $crumb; } $_SESSION['breadcrumb'] = $this->crumbs; //Persist the data $this->crumbs[$level]['url'] = null; //Ditch the underlying url for the current page. } /* * Output a semantic list of links. See above for sample CSS. Modify this to suit your design. */ function output(){ echo "<div id='breadcrumb'><ul><li>Click trail: </li>"; foreach ($this->crumbs as $crumb){ if ($crumb['url'] != null){ echo "<li> > <a href='".$crumb['url']."' title='".$crumb['label']."'>".$crumb['label']."</a></li> "; } else { echo "<li> > ".$crumb['label']."</li> "; } } echo "</ul></div>"; } } ?>
  2. Does anyone have any easy to follow code or examples usibg breadcrumb navigation?
  3. I am wanting some easy to follow code implementing breadcrumbs in php.
  4. This function dosen't work properly. Any clues? function makeSelect($name,$label,$options,$value='',$message='') { $this->count++; $html ="<div class ='selectRow'>"; $this->makeLabel($name, $label); $html.='<select id="'.$name. '"name="'.$name.'" tabindex= "'.$this->count.'" class ="selectBox">'; foreach($options as $optionValue=>$optionLabel){ $checked = $optionValue == $value ? " checked " : ""; $html.="<option value ='$optionValue' $checked>$optionLabel</option>"; } $html.="</select>"; $this->makeMessage($message); $html.="</div>" ; $this->html.= $html; } Associated Errors # Line 60, Column > 80: XML Parsing Error: attributes construct error …ltipart/form-data"><div class="boxa"><div class="label"><label for="name">You… ✉ # Error Line 60, Column > 80: XML Parsing Error: Couldn't find end of Start Tag select line 60 …ltipart/form-data"><div class="boxa"><div class="label"><label for="name">You… ✉ # Error Line 60, Column > 80: XML Parsing Error: Opening and ending tag mismatch: div line 60 and select …ltipart/form-data"><div class="boxa"><div class="label"><label for="name">You… ✉ # Error Line 60, Column > 80: XML Parsing Error: Opening and ending tag mismatch: form line 60 and div …ltipart/form-data"><div class="boxa"><div class="label"><label for="name">You… ✉ # Error Line 60, Column > 80: XML Parsing Error: Opening and ending tag mismatch: div line 52 and form …ltipart/form-data"><div class="boxa"><div class="label"><label for="name">You… ✉ # Error Line 88, Column 6: XML Parsing Error: Opening and ending tag mismatch: body line 24 and div </div> ✉ # Error Line 89, Column 7: XML Parsing Error: Opening and ending tag mismatch: html line 2 and body </body> Full code for page <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Dave's Web Designs</title> <link rel="stylesheet" href="assets/css/blueprint/screen.css" type="text/css" media="screen, projection" /> <link rel="stylesheet" href="assets/css/blueprint/grid.css" type="text/css" media="screen, projection" /> <link rel="stylesheet" href="assets/css/blueprint/print.css" type="text/css" media="print" /> <!--[if IE 8]> <link href="assets/IE - 8 - specific.css" rel="stylesheet" type="text/css" /> <![endif]--> <!--[if IE 7]> <link href="assets/IE - 7 - specific.css" rel="stylesheet" type="text/css" /> <![endif]--> <!--[if IE 6]> <link href="assets/IE - 6 - specific.css" rel="stylesheet" type="text/css" /> <![endif]--> <link href="assets/portfolio.css" type="text/css" rel="stylesheet" media="screen" /> <script type="text/javascript" src="assets/mootools.js"></script> <script type="text/javascript" src="assets/demo.js"></script> <script type="text/javascript" src="assets/portfolio.js"></script> </head> <body> <div id="container"> <div class = "content"> <div class="span-20 last" > <div class="span-1 last"> <span class = "dheader">D</span> </div> <div class="span-19 last"> <div class="span-8 "> <span class = "hheader"> ave's Web</span> </div> <div class="span-5 last prepend-6"> <span class= "navigation"> <a href="index.php">Home</a> <a href="profile.php">Profile</a> <a href="contact.php">Contact Me</a> </span> </div> <!--end div for span-4 last prepend-6--> </div><!--end div for span-19 last--> </div> <div class = "span-1"> <div class = "eheader">e</div> <div class ="sheader">s</div> <div class ="iheader">i</div> <div class ="gheader">g</div> <div class ="nheader">n</div> <div class ="ssheader">s</div> </div> <div class = "contactPage"> <div class = "span-17 prepend-1"> <div class = "request"> Request for a price<br /> Please contact me:<span class="number"> Phone 03 359 0343</span> or <span class="number">Phone 027 308 9169</span><br /> or fill out the form blow<br /> </div> <div class="vspace"> </div> <form action=" " method= "post" enctype="multipart/form-data"><div class="boxa"><div class="label"><label for="name">Your Name</label></div><div class="formMessage"></div><div class="row"><input tabindex="1" type="text" name="name" id="name" value="" /></div><div class="label"><label for="company">Your Company</label></div><div class="formMessage"></div><div class="row"><input tabindex="2" type="text" name="company" id="company" value="" /></div><div class="label"><label for="email">Your Email</label></div><div class="formMessage"></div><div class="row"><input tabindex="3" type="text" name="email" id="email" value="" /></div><div class="label"><label for="phone">Your Phone</label></div><div class="formMessage"></div><div class="row"><input tabindex="4" type="text" name="phone" id="phone" value="" /></div><div class="label"><label for="mobilephone">Your Mobile Phone</label></div><div class="formMessage"></div><div class="row"><input tabindex="5" type="text" name="mobilephone" id="mobilephone" value="" /></div></div><div class="vspace"></div><div class="boxa"><div class="label"><label for="workRequired">Type of work required</label></div><div class="formMessage"></div><div class ='selectRow'><select id="workRequired"name="workRequired" tabindex= "6" class ="selectBox"><option value ='a new website' >a new website</option><option value ='a redesign of an existing website' >a redesign of an existing website</option><option value ='other' >other</option></select></div></div><div class="vspace"></div><div class="boxa"><div class="label"><label for="message">Additional Comments</label></div><div class="formMessage"></div><div class="textarea"><textarea tabindex="7" name="message" id="message" rows="5" cols="20" ></textarea></div><br /></div><div class="vspace"></div><div class="boxa"><div class="capthca"><img src="captcha.php" alt="captcha security code" /></div><div class="label"><label for="capthca">Security Code</label></div><div class="formMessage"></div><div class="row"><input tabindex="8" type="text" name="capthca" id="capthca" value="" /></div></div><div class="submit"><input type = "submit" id="submit" name="submit" value="Submit Request" class="submitButton" /> </div><br /></form> </div><!--end for span-17 prepend-1--> </div><!--end for contact--> <div class = "span-17 prepend-2"> <div class = "filler"> </div> <div class = "span-3"> <a href="http://validator.w3.org/check?uri=referer"><img src="http://www.w3.org/Icons/valid-xhtml10" alt="Valid XHTML 1.0 Transitional" height="31" width="88" /></a> </div><!--end div for span-3--> <div class = "span-6 prepend-3"> <div class = "contact"> Dave Merrick<br /> Home Ph: 03 3590 343<br /> Mobile Ph: 027 3089 169<br /> Email: <a href="mailto:merrickdav@gmail.com">merrickdav@gmail.com</a><br /> Click here to see <a href="Images/DavesCV.odt" target="_blank">Dave's CV</a> </div> </div><!--end div for span-6 prepend-3--> <div class = "span-3"> <a href="http://jigsaw.w3.org/css-validator/check/referer"> <img style="border:0;width:88px;height:31px" src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Valid CSS!" /> </a> </div><!--end div for span-3--> </div><!--span-17 prepend-2--> </div> </div> </body> </html>
×
×
  • 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.