DokuWiki

It's better when it's simple

User Tools

Site Tools


devel:menus

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
devel:menus [2019-01-06 14:55]
Aleksandr
devel:menus [2019-05-06 22:23] (current)
daumling
Line 53: Line 53:
  
 Please refer to the [[gh>inc/Menu/AbstractMenu.php|source]] for what else is available. Please refer to the [[gh>inc/Menu/AbstractMenu.php|source]] for what else is available.
 +
 +If you need specific HTML for menu items, you need to loop over the menu items and create the HTML
 +yourself. For example, this loop would create the icons in the [[:template:writr|writr template]], which is a bit more complex:
 +
 +<code php>
 +$items = (new \dokuwiki\Menu\PageMenu())->getItems();
 +foreach($items as $item) {
 +  echo '<li>'
 +      .'<a href="'.$item->getLink().'" title="'.$item->getTitle().'">'
 +      .'<span class="icon">'.inlineSVG($item->getSvg()).'</span>'
 +      . '<span class="a11y">'.$item->getLabel().'</span>'
 +      . '</a></li>';
 +}
 +</code>
  
 ===== Legacy Support ===== ===== Legacy Support =====
devel/menus.txt ยท Last modified: 2019-05-06 22:23 by daumling