PHP:
скопировать код в буфер обмена
скопировать код в буфер обмена
- <?
- require_once 'Zend/View/Helper/Placeholder/Container/Standalone.php';
- class Nog_View_Helper_BreadCrumbs extends Zend_View_Helper_Placeholder_Container_Standalone
- {
- protected $_regKey = 'Zend_View_Helper_BreadCrumbs';
- protected $_autoEscape = false;
- protected $_divClass = 'bread_crumbs';
- public function setDivClass($className)
- {
- $this->_divClass = $className;
- }
- public function getDivClass()
- {
- return $this->_divClass;
- }
- public function breadCrumbs($title = null, $url = null, $setType = Zend_View_Helper_Placeholder_Container_Abstract::APPEND)
- {
- if ($title) {
- $linkArray['title'] = $title;
- $linkArray['url'] = $url;
- if ($setType == Zend_View_Helper_Placeholder_Container_Abstract::SET) {
- $this->set($linkArray);
- } elseif ($setType == Zend_View_Helper_Placeholder_Container_Abstract::PREPEND) {
- $this->prepend($linkArray);
- } else {
- $this->append($linkArray);
- }
- return false;
- }
- return $this;
- }
- public function toString($indent = null, $locale = null)
- {
- $indent = (null !== $indent)
- ? $this->getWhitespace($indent)
- : $this->getIndent();
- foreach ($this as $item) {
- $items[] = $item;
- }
- $separator = $this->getSeparator();
- $output = '';
- if(($prefix = $this->getPrefix())) {
- $output .= $prefix;
- }
- $i=1;
- foreach ($items as $value) {
- $output .= ($i++ == $count)
- ? "<span>" . $value['title'] . "</span>"
- : '<a href="'. $value['url'] .'">'. $value['title'] .'</a> '. $separator .' ';
- }
- if(($postfix = $this->getPostfix())) {
- $output .= $postfix;
- }
- // т.к. в выводе присутствуют теги - то ничего экранировать не надо
- //$output = ($this->_autoEscape) ? $this->_escape($output) : $output;
- return $indent . "<div class='{$this->_divClass}'>" .$output . '</div>';
- }
- }