PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » HTML » HTML_Menu » Bug #4703

Row Menus need addSeparator method

Details

Request #4703Row Menus need addSeparator method
Submitted2005-06-29 16:58 UTC
Fromxulchris at gmail dot com
StatusWont fix
PackageHTML_Menu
PHP Version4.3.2
OSRHEL3
Roadmaps(Not assigned)

Comments

[2005-06-29 16:58 UTC] xulchris at gmail dot com

Description:
------------
HTML_Menu-2.1.1

When building a row menu, you must specify a separator in the template file which leads to the following two possible results:

 | Item 1 | Item 2 | Item 3

or

Item 1 | Item 2 | Item 3 | 

Reproduce code:
---------------
This means that I must chop off either the first or last separator after generating the HTML currently I use the following code:

$menu =& new HTML_Menu($data);
$tpl =& new HTML_Template_Sigma('./templates');
$tpl->loadTemplateFile($template);
$renderer =& new HTML_Menu_SigmaRenderer($tpl, 'rows_');
$menu->render($renderer, 'rows');
//$tpl->show();
// This is a hack because row menus don't have a row seperator
$html = $tpl->get();
$pos = strpos($html, '<a');
$_html = substr($html, 0, $pos);
$_html = str_replace("|", "", $_html);
echo trim($_html) . substr($html, $pos);

Expected result:
----------------
The current Menu runs as expected, I need extra functionality to achieve desired results without adding ugly code to chop off generated HTML.

Actual result:
--------------
What I want is the ability to do something like this:

$menu =& new HTML_Menu($data);
...
$menu->render($renderer, 'rows', " | ");

Where the 3rd parameter specifies the separator between menu entries. Resulting in a menu like this:

Item 1 | Item 2 | Item 3