Quick Search:

View

Revision:

Diff

Diff from 1497 to:

Annotations

Annotate by Age | Author | Mixed | None
/fisheye/browse/osCommerce/branches/hpdl/oscommerce/includes/classes/breadcrumb.php

Annotated File View

hpdl
1
1 <?php
2 /*
hpdl
153
3   $Id: breadcrumb.php 1497 2007-03-29 13:40:05Z hpdl $
hpdl
1
4
5   osCommerce, Open Source E-Commerce Solutions
6   http://www.oscommerce.com
7
hpdl
669
8   Copyright (c) 2006 osCommerce
hpdl
1
9
hpdl
1497
10   This program is free software; you can redistribute it and/or modify
11   it under the terms of the GNU General Public License v2 (1991)
12   as published by the Free Software Foundation.
hpdl
1
13 */
14
15   class breadcrumb {
16     var $_trail;
17
18     function breadcrumb() {
19       $this->reset();
20     }
21
22     function reset() {
23       $this->_trail = array();
24     }
25
26     function add($title, $link = '') {
27       $this->_trail[] = array('title' => $title, 'link' => $link);
28     }
29
30     function trail($separator = ' - ') {
31       $trail_string = '';
32
33       for ($i=0, $n=sizeof($this->_trail); $i<$n; $i++) {
hpdl
734
34         if (isset($this->_trail[$i]['link']) && !empty($this->_trail[$i]['link'])) {
hpdl
669
35           $trail_string .= osc_link_object($this->_trail[$i]['link'], $this->_trail[$i]['title']);
hpdl
1
36         } else {
37           $trail_string .= $this->_trail[$i]['title'];
38         }
39
40         if (($i+1) < $n) $trail_string .= $separator;
41       }
42
43       return $trail_string;
44     }
45   }
46 ?>