PEAR is discontinued

This is a static archive preserving historical releases and metadata. No new packages or updates will be published. For updates to existing packages, or to publish new packages, please use Composer and Packagist.

Home » HTML » HTML_Menu » Bug #2710

{desc} is not delete

Details

Request #2710{desc} is not delete
Submitted2004-11-07 13:20 UTC
FromKoala at Koalashome dot de
StatusWont fix
PackageHTML_Menu
PHP Version4.3.4
OSLinux
Roadmaps(Not assigned)

Comments

[2004-11-07 13:20 UTC] Koala at Koalashome dot de

Description:
------------
HTML_Menu 2.1.1
File: DirectRenderer.php

In the templates you can set short tags that you will
replace with content. e.g. {url}, {desc}
But when in the data-array (menu.php) this tag is not set,
you have this in the output also.

Better is, when the not used tags will be deleted.

Reproduce code:
---------------
DirectRenderer.php
Used {desc}-tag:

/**
* Templates for menu entries
* @see setEntryTemplate()
* @var array
*/
var $_entryTemplates = array(
HTML_MENU_ENTRY_INACTIVE => '<td>{indent}<a href="{url}" title="{desc}">{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>'
);

At the end of function renderEntry($node, $level, $type) replace this:

$this->_rowHtml .= str_replace($keys, $values, $this->_entryTemplates[$type]);

with this:

$str = preg_replace('/{[^ \t\r\n}]+}/', "", str_replace($keys, $values, $this->_entryTemplates[$type]));
$this->_rowHtml .= $str;

The preg_replace code is from the PHPLib template class. (-: