Monday, February 27, 2012

PHP : Function Create Menu

You can use this function to create dropdown menu, vertical menu, menu tree, or whatever you want.



Sample Output :

Select menu from database :

$query = mysql_query("select * from menu order by orderby");
Create array menun:
while($row=mysql_fetch_array($query)){
    $data[$row['parent_id']][]=$row;
}

Function :

getMenu($arrMenu,$parent,$menuId,$title,$link)

$arrMenu -> array menu
$parent -> first parent menu
$menuId -> field name id menu
$title -> field name title menu
$link -> field name link menu

<?=getMenu($data,0,'id','name','link');?>

Download Link
http://www.4shared.com/zip/6CmblAqr/php_function_create_menu.html

0 comments:

Post a Comment

Twitter Delicious Facebook Digg Stumbleupon Favorites More

 
Design by NewWpThemes | Blogger Theme by Lasantha - Premium Blogger Themes | New Blogger Themes