mtpoc22 Posted July 27, 2003 Posted July 27, 2003 I'm fairly new to PHP. I've basically taught myself to use it quite well in the last 72 hours, but I made a mistake and I cant fix it. I accidently deleted the reference to includes/classes/breadcrumb.php in the includes/header.php file. I've tried using this code to refer back to it: require('includes/classes/breadcrumb.php'); This code always give me this error: Fatal error: Cannot redeclare class breadcrumb in /home/virtual/site98/fst/var/www/html/catalog/includes/classes/breadcrumb.php My breadcrumb.php file's code is: <?php class breadcrumb { var $_trail; function breadcrumb() { $this->reset(); } function reset() { $this->_trail = array(); } function add($title, $link = '') { $this->_trail[] = array('title' => $title, 'link' => $link); } function trail($separator = ' - ') { $trail_string = ''; for ($i=0, $n=sizeof($this->_trail); $i<$n; $i++) { if (isset($this->_trail[$i]['link']) && tep_not_null($this->_trail[$i]['link'])) { $trail_string .= '<a href="' . $this->_trail[$i]['link'] . '" class="headerNavigation">' . $this->_trail[$i]['title'] . '</a>'; } else { $trail_string .= $this->_trail[$i]['title']; } if (($i+1) < $n) $trail_string .= $separator; } return $trail_string; } } ?>
Guest Posted July 27, 2003 Posted July 27, 2003 include/application_top.php does the require on breadcrumb.php. In header.php, you want to have something like this section of code: <table border="0" width="100%" cellspacing="0" cellpadding="1"> <tr class="headerNavigation"> <td class="headerNavigation"> <?php echo $breadcrumb->trail(' » '); ?></td> <td align="right" class="headerNavigation"><?php if (tep_session_is_registered('customer_id')) { ?><a href="<?php echo tep_href_link(FILENAME_LOGOFF, '', 'SSL'); ?>" class="headerNavigation"><?php echo HEADER_TITLE_LOGOFF; ?></a> | <?php } ?><a href="<?php echo tep_href_link(FILENAME_ACCOUNT, '', 'SSL'); ?>" class="headerNavigation"><?php echo HEADER_TITLE_MY_ACCOUNT; ?></a> | <a href="<?php echo tep_href_link(FILENAME_SHOPPING_CART); ?>" class="headerNavigation"><?php echo HEADER_TITLE_CART_CONTENTS; ?></a> | <a href="<?php echo tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'); ?>" class="headerNavigation"><?php echo HEADER_TITLE_CHECKOUT; ?></a> </td> </tr> </table> It's the third line that's important for the breadcrumb. You may or may not already have the rest of the table defined. Good luck, Matt
Guest Posted July 27, 2003 Posted July 27, 2003 you only need this: <?php echo $breadcrumb->trail(' » '); ?> you might want to think about some sort of source control system, even if its as simple as keeping a daily backup.
mtpoc22 Posted July 27, 2003 Author Posted July 27, 2003 Thanks for the help. That one line of string is what i needed. Thanks again :!: Steve :lol:
Recommended Posts
Archived
This topic is now archived and is closed to further replies.