📄 menulist.php
字号:
<?php/** * Zend_View_Helper_FormELement */require_once 'Zend/View/Helper/FormElement.php';/** * Helper for ordered and unordered lists * * @uses Zend_View_Helper_FormElement * @category Zend * @package Zend_View * @subpackage Helper * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */class Zend_View_Helper_MenuList extends Zend_View_Helper_FormElement{ /** * Generates a 'List' element. * * @param array $items Array with the elements of the list * @param boolean $ordered Specifies ordered/unordered list; default unordered * @param array $attribs Attributes for the ol/ul tag. * @return string The list XHTML. */ public function menuList(array $items, $classCurrent = 'menucurrent', $ordered = false, $attribs = false, $escape = false) { if (!is_array($items)) { require_once 'Zend/View/Exception.php'; throw new Zend_View_Exception('First param must be an array', $this); } $list = ''; foreach ($items as $titre => $link) { if (!is_array($titre)) { if ($escape) $titre = $this->view->escape($titre); $list .= '<li class="'; $list .= ("http://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'] == $link)?$classCurrent:'menu'; $list .= '"><a href="'.$link.'">' . $titre. '</a></li>'; } else { if (5 < strlen($list)) { $list = substr($list, 0, strlen($list) - 5) . $this->htmlList($titre, $ordered, $attribs, $escape) . '</li>'; } else { $list .= '<li>' . $this->htmlList($titre, $ordered) . '</li>'; } } } if ($attribs) { $attribs = $this->_htmlAttribs($attribs); } else { $attribs = ''; } $tag = 'ul'; if ($ordered) { $tag = 'ol'; } return '<' . $tag . $attribs . '>' . $list . '</' . $tag . '>'; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -