menu
is a simply little html generator really. I wrote it to easily interact with jQueryUI’s accordion menu. Essentially you add a variety of menuItems
and then call the asHtml()
method to generate an un-ordered list suitable for use with jQueryUI’s accordion menu.
Parent Class
None
Public Properties
Data Type: string
Default Value: ‘accordion’
Public Methods
Parameters:
$id
(string: optional) is the value used for the html ID attribute. Default: ‘accordion’Returns:
A
menu
instanceExample:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
$myMenu = new \ipinga\menu('left_menu'); $myMenu->addItem( 'Main Menu', 'Home', '/index' ); $myMenu->addItem( 'Main Menu', 'My Account', '/account_info' ); $myMenu->addItem( 'Messages', 'Create New Message', '/messages/create'); echo $myMenu->asHtml(); outputs: <!-- Start of accordion menu --> <ul id="left_menu"> <li> <h3><a>Main Menu</a></h3> <ul> <li><a href="/index">Home</a></li> <li><a href="/account_info">My Account</a></li> </ul> </li> <li> <h3><a>Messages</a></h3> <ul> <li><a href="/messages/create">Create New Message</a></li> </ul> </li> </ul><!-- End of accordion menu --> |
menuItem
object, but it is not exposed.Parameters:
$tab
(string) The tab name you want this option to appear on$name
(string) The menu item name (ie: the text that will appear for this link)$url
(string) The url to take the user to when they click on the menuItem$target
(string: optional) The value used for the html TARGET attribute. Default: noneReturns:
null
Parameters:
None
Returns:
The HTML string