DirectTreeRenderer::setEntryTemplate() – Sets the template for menu entry.


require_once 'HTML/Menu/DirectTreeRenderer.php';

void HTML_Menu_DirectTreeRenderer::setEntryTemplate ( mixed $type , string $template = null )


The template should contain at least the {title} placeholder, can also contain {url} placeholder. Default templates are:

HTML_MENU_ENTRY_INACTIVE    => '<a href="{url}">{title}</a>',
HTML_MENU_ENTRY_ACTIVE      => '<strong>{title}</strong>',
HTML_MENU_ENTRY_ACTIVEPATH  => '<a href="{url}"><em>{title}</em></a>'

If custom keys are present in the original menu structure, they will be assigned to the corresponding placeholders.


mixed $type

either type (one of HTML_MENU_ENTRY_* constants) or an array 'type' => 'template'

string $template

template for this entry type if $type is not an array


throws no exceptions thrown


This function can not be called statically.

The "direct" renderer for 'tree' and 'sitemap' menu types where level is represented by tags nesting. (Previous) Sets the item template (HTML that wraps around entries) (Next)
Last updated: Sat, 16 Feb 2019 — Download Documentation
Do you think that something on this page is wrong? Please file a bug report.
View this page in:
  • English

User Notes:

There are no user contributed notes for this page.