PHP Classes

File: create.php

Recommend this page to a friend!
  Classes of mohamad Reza kavoosi   PHP Menu Generator   create.php   Download  
File: create.php
Role: Example script
Content type: text/plain
Description: create and modify menu at this file
Class: PHP Menu Generator
Generate nested menus with HTML list items
Author: By
Last change:
Date: 9 years ago
Size: 1,048 bytes
 

Contents

Class file image Download
<?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>";