[ Index ] |
|
Code source de Zen Cart E-Commerce Shopping Cart 1.3.7.1 |
1 <?php 2 /** 3 * breadcrumb Class. 4 * 5 * @package classes 6 * @copyright Copyright 2003-2006 Zen Cart Development Team 7 * @copyright Portions Copyright 2003 osCommerce 8 * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0 9 * @version $Id: breadcrumb.php 3147 2006-03-10 00:43:57Z drbyte $ 10 */ 11 if (!defined('IS_ADMIN_FLAG')) { 12 die('Illegal Access'); 13 } 14 15 /** 16 * The following switch simply checks to see if the setting is already defined, and if not, sets it to true 17 * If you desire to have the older behaviour of having all product and category items in the breadcrumb be shown as links 18 * then you should add a define() for this item in the extra_datafiles folder and set it to 'false' instead of 'true': 19 */ 20 if (!defined('DISABLE_BREADCRUMB_LINKS_ON_LAST_ITEM')) define('DISABLE_BREADCRUMB_LINKS_ON_LAST_ITEM','true'); 21 22 /** 23 * breadcrumb Class. 24 * Class to handle page breadcrumbs 25 * 26 * @package classes 27 */ 28 class breadcrumb extends base { 29 var $_trail; 30 31 function breadcrumb() { 32 $this->reset(); 33 } 34 35 function reset() { 36 $this->_trail = array(); 37 } 38 39 function add($title, $link = '') { 40 $this->_trail[] = array('title' => $title, 'link' => $link); 41 } 42 43 function trail($separator = ' ') { 44 $trail_string = ''; 45 46 for ($i=0, $n=sizeof($this->_trail); $i<$n; $i++) { 47 // echo 'breadcrumb ' . $i . ' of ' . $n . ': ' . $this->_trail[$i]['title'] . '<br />'; 48 $skip_link = false; 49 if ($i==($n-1) && DISABLE_BREADCRUMB_LINKS_ON_LAST_ITEM =='true') { 50 $skip_link = true; 51 } 52 if (isset($this->_trail[$i]['link']) && zen_not_null($this->_trail[$i]['link']) && !$skip_link ) { 53 // this line simply sets the "Home" link to be the domain/url, not main_page=index?blahblah: 54 if ($this->_trail[$i]['title'] == HEADER_TITLE_CATALOG) { 55 $trail_string .= ' <a href="' . HTTP_SERVER . DIR_WS_CATALOG . '">' . $this->_trail[$i]['title'] . '</a>'; 56 } else { 57 $trail_string .= ' <a href="' . $this->_trail[$i]['link'] . '">' . $this->_trail[$i]['title'] . '</a>'; 58 } 59 } else { 60 $trail_string .= $this->_trail[$i]['title']; 61 } 62 63 if (($i+1) < $n) $trail_string .= $separator; 64 $trail_string .= "\n"; 65 } 66 67 return $trail_string; 68 } 69 70 function last() { 71 $trail_size = sizeof($this->_trail); 72 return $this->_trail[$trail_size-1]['title']; 73 } 74 } 75 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Mon Nov 26 16:45:43 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |