Source for file DirectRenderer.php
Documentation is available at DirectRenderer.php
// +----------------------------------------------------------------------+
// +----------------------------------------------------------------------+
// | Copyright (c) 1997-2003 The PHP Group |
// +----------------------------------------------------------------------+
// | This source file is subject to version 2.0 of the PHP license, |
// | that is bundled with this package in the file LICENSE, and is |
// | available at through the world-wide-web at |
// | http://www.php.net/license/2_02.txt. |
// | If you did not receive a copy of the PHP license and are unable to |
// | obtain it through the world-wide-web, please send a note to |
// | license@php.net so we can mail you a copy immediately. |
// +----------------------------------------------------------------------+
// | Authors: Ulf Wendel <ulf.wendel@phpdoc.de> |
// | Sebastian Bergmann <sb@sebastian-bergmann.de> |
// | Alexey Borzov <avb@php.net> |
// +----------------------------------------------------------------------+
// $Id: DirectRenderer.php,v 1.3 2004/01/18 17:35:52 avb Exp $
require_once 'HTML/Menu/Renderer.php';
* The renderer that generates HTML for the menu all by itself.
* Inspired by HTML_Menu 1.0 code
* @version $Revision: 1.3 $
* @author Ulf Wendel <ulf.wendel@phpdoc.de>
* @author Alexey Borzov <avb@php.net>
* Generated HTML for the menu
* Generated HTML for the current menu "table"
* Generated HTML for the current menu "row"
* The HTML that will wrap around menu "table"
var $_menuTemplate = array ('<table border="1">', '</table>');
* The HTML that will wrap around menu "row"
var $_rowTemplate = array ('<tr>', '</tr>');
* Templates for menu entries
* @see setEntryTemplate()
var $_entryTemplates = array (
HTML_MENU_ENTRY_INACTIVE => '<td>{indent}<a href="{url}">{title}</a></td>',
HTML_MENU_ENTRY_ACTIVE => '<td>{indent}<b>{title}</b></td>',
HTML_MENU_ENTRY_ACTIVEPATH => '<td>{indent}<b><a href="{url}">{title}</a></b></td>',
HTML_MENU_ENTRY_PREVIOUS => '<td><a href="{url}"><< {title}</a></td>',
HTML_MENU_ENTRY_NEXT => '<td><a href="{url}">{title} >></a></td>',
HTML_MENU_ENTRY_UPPER => '<td><a href="{url}">^ {title} ^</a></td>',
HTML_MENU_ENTRY_BREADCRUMB => '<td><a href="{url}">{title}</a> >> </td>'
$this->_html .= $this->_menuTemplate[0 ] . $this->_tableHtml . $this->_menuTemplate[1 ];
$this->_tableHtml .= $this->_rowTemplate[0 ] . $this->_rowHtml . $this->_rowTemplate[1 ];
$keys = array ('{indent}');
if ('tree' == $this->_menuType || 'sitemap' == $this->_menuType) {
$values = array (str_repeat(' ', $level));
foreach ($node as $k => $v) {
$keys[] = '{' . $k . '}';
$this->_rowHtml .= str_replace($keys, $values, $this->_entryTemplates[$type]);
* returns the HTML generated for the menu
* Sets the menu template (HTML that wraps around rows)
* @param string this will be prepended to the rows HTML
* @param string this will be appended to the rows HTML
$this->_menuTemplate = array ($prepend, $append);
* Sets the row template (HTML that wraps around entries)
* @param string this will be prepended to the entries HTML
* @param string this will be appended to the entries HTML
$this->_rowTemplate = array ($prepend, $append);
* Sets the template for menu entry.
* The template should contain at least the {title} placeholder, can also contain
* {url} and {indent} placeholders, depending on entry type.
* @param mixed either type (one of HTML_MENU_ENTRY_* constants) or an array 'type' => 'template'
* @param string template for this entry type if $type is not an array
// array_merge() will not work here: the keys are numeric
foreach ($type as $typeId => $typeTemplate) {
if (isset ($this->_entryTemplates[$typeId])) {
$this->_entryTemplates[$typeId] = $typeTemplate;
$this->_entryTemplates[$type] = $template;
Documentation generated on Mon, 11 Mar 2019 10:16:40 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.
|