A modern package to generate html menus:
Virtually every website displays some sort of menu. Generating html menus might seem simple, but it can become complex very quickly. Not only do you have to render some basic html, but you also have to manage which item is active. If a menu has submenu you’ll also want the parents of an active item to be active. Sometimes you want to insert some html between menu items.
Here is an example of the API and you can see how easy generating a menu is.
Menu::new()
->add(Menu::new()
->link('/introduction', 'Introduction')
->link('/requirements', 'Requirements')
->link('/installation-setup', 'Installation and Setup')
)
->add(Menu::new()
->prepend('<h2>Basic Usage</h2>')
->prefixLinks('/basic-usage')
->link('/your-first-menu', 'Your First Menu')
->link('/working-with-items', 'Working With Items')
->link('/adding-sub-menus', 'Adding Sub Menus')
);
0 comments:
Post a Comment
Thanks