PHP Classes

PHP Menu Generator: Generate nested menus with HTML list items

Recommend this page to a friend!
  Info   View files Example   View files View files (5)   DownloadInstall with Composer Download .zip   Reputation   Support forum (2)   Blog    
Ratings Unique User Downloads Download Rankings
StarStarStar 49%Total: 759 All time: 4,439 This week: 86Up
Version License PHP version Categories
menu-generator 2.3Free For Educatio...5HTML, Templates, Design Patterns
Description 

Author

This class can generate nested menus with HTML list items.

It can compose a menu by adding root items and child items to its definition.

Menu items may be defined by text and optional links. The menu styles can be defined using CSS classes.

The class can also modify or remove items.

The composed menu can generate as an HTML list of items and saved to a file.

The class can also show the generated menu by loading the generated menu file.

Picture of mohamad Reza kavoosi
  Performance   Level  
Name: mohamad Reza kavoosi is available for providing paid consulting. Contact mohamad Reza kavoosi .
Classes: 5 packages by
Country: Iran Iran
Age: 35
All time rank: 7926 in Iran Iran
Week rank: 358 Up6 in Iran Iran Equal
Innovation award
Innovation award
Nominee: 1x

Winner: 1x

Example

<?php
require_once 'menuClass.php';
$menu=menu::init();
$item1=$menu->addRootItem('item0');
   
$item1->addChild('item1-1');
   
$item1->addChild('item1-2')->addChild('item1-2-1');
   
$item1->addChild('item1-3');
$menu->addRootItem('item1');
$menu->addRootItem('item2')->addChild('my profile','http://www.phpclasses.org/browse/author/916379.html','_blank');
$menu->addRootItem('item3');

//to remove ITEM :
/**
 $menu->removeItemByPath('0\1\0');
 OR
 $item1->remove();
**********************************************/
//TO Add css class for MENU,root item,child item :
/**
 $menu->cssClass= "classNames";
 $menu->GetItemByPath('0\1')->cssClass= "classNames";
**********************************************/
$menu->cssClass="menu";
//TO modify or edit Feature item :
/**
$menu->GetItemByPath('0\0\1')->title = "enter new title";
OR
$item1->title = "enter new title";
**********************************************/
if ($menu->save())
    echo
"The menu was created,Now you can <a href='index.php'>see menu</a>";




Details

with this class you can create and generate menu and list. Features this class is: 1- add items 2- add sub items 3- add css class for menu and items 4- access childs with path address 5- remove child 6- modify and edit childs 7- save menu

  Files folder image Files  
File Role Description
Accessible without login Plain text file create.php Example create and modify menu at this file
Accessible without login Plain text file index.php Example example of how to use and show generated menu
Plain text file menuClass.php Class main class
Accessible without login Plain text file readme.txt Data read me file
Accessible without login Plain text file style.css Data style of menu

 Version Control Unique User Downloads Download Rankings  
 0%
Total:759
This week:0
All time:4,439
This week:86Up
User Ratings User Comments (2)
 All time
Utility:70%StarStarStarStar
Consistency:65%StarStarStarStar
Documentation:-
Examples:80%StarStarStarStarStar
Tests:-
Videos:-
Overall:49%StarStarStar
Rank:2722
 
Good job.
8 years ago (alexandru traian)
70%StarStarStarStar
HI Public members, Capital and small letter mixed, base64 fo...
8 years ago (keran)
2%Star