Warning: Cannot use a scalar value as an array in /home/admin/public_html/forum/include/fm.class.php on line 757

Warning: Invalid argument supplied for foreach() in /home/admin/public_html/forum/include/fm.class.php on line 770
Форумы портала PHP.SU :: Версия для печати :: Хлебные крошки
Форумы портала PHP.SU » » CMS и фреймворки » Хлебные крошки

Страниц (1): [1]
 

1. assd - 14 Августа, 2012 - 11:08:33 - перейти к сообщению
Здравствуйте. Я раньше не работал с Zend Framework, по-этому не судите строго))) Нашел на форуме тему с хлебными крошками http://zendframework[dot]ru/forum/in[dot][dot][dot].php?topic=195[dot]0 Возник вопрос как интегрировать этот модуль на сайт. Мне нужно скачать какие-то библиотеки? Потом их подключать или как? Заранее спасибо за помощь)))
PHP:
скопировать код в буфер обмена
  1.  
  2. <?
  3. require_once 'Zend/View/Helper/Placeholder/Container/Standalone.php';
  4.  
  5. class Nog_View_Helper_BreadCrumbs extends Zend_View_Helper_Placeholder_Container_Standalone
  6. {
  7.     protected $_regKey = 'Zend_View_Helper_BreadCrumbs';
  8.     protected $_autoEscape = false;
  9.     protected $_divClass = 'bread_crumbs';
  10.    
  11.     public function setDivClass($className)
  12.     {
  13.         $this->_divClass = $className;
  14.     }
  15.    
  16.     public function getDivClass()
  17.     {
  18.         return $this->_divClass;
  19.     }
  20.     public function breadCrumbs($title = null, $url = null, $setType = Zend_View_Helper_Placeholder_Container_Abstract::APPEND)
  21.     {
  22.         if ($title) {
  23.             $linkArray = array();
  24.             $linkArray['title'] = $title;
  25.             $linkArray['url'] = $url;
  26.             if ($setType == Zend_View_Helper_Placeholder_Container_Abstract::SET) {
  27.                 $this->set($linkArray);
  28.             } elseif ($setType == Zend_View_Helper_Placeholder_Container_Abstract::PREPEND) {
  29.                 $this->prepend($linkArray);
  30.             } else {
  31.                 $this->append($linkArray);
  32.             }
  33.             return false;
  34.         }
  35.  
  36.         return $this;
  37.        
  38.     }
  39.    
  40.    
  41.     public function toString($indent = null, $locale = null)
  42.     {
  43.        
  44.         $indent = (null !== $indent)
  45.                 ? $this->getWhitespace($indent)
  46.                 : $this->getIndent();
  47.  
  48.         $items = array();
  49.  
  50.         foreach ($this as $item) {
  51.             $items[] = $item;
  52.         }
  53.  
  54.         $separator = $this->getSeparator();
  55.         $output = '';
  56.         if(($prefix = $this->getPrefix())) {
  57.             $output  .= $prefix;
  58.         }
  59.         $count = count($items);
  60.         $i=1;
  61.         foreach ($items as $value) {
  62.             $output .= ($i++ == $count)
  63.                         ? "<span>" . $value['title'] . "</span>"
  64.                         : '<a href="'. $value['url'] .'">'. $value['title'] .'</a> '. $separator .' ';
  65.         }            
  66.        
  67.         if(($postfix = $this->getPostfix())) {
  68.             $output .= $postfix;
  69.         }
  70.         // т.к. в выводе присутствуют теги - то ничего экранировать не надо
  71.         //$output = ($this->_autoEscape) ? $this->_escape($output) : $output;
  72.  
  73.         return $indent . "<div class='{$this->_divClass}'>" .$output . '</div>';
  74.     }
  75. }
  76.  

 

Powered by ExBB FM 1.0 RC1