## How to create menu in any Application reading menu from text file and apply local CSS ## ##Folder Location: Path: /saumitra/saumitra_POC/mahesh/menu_work/main_menu_work/ ##File Names: 1. menu.txt 2. menu_call.php 3. main_menu.php ##File details: 1. menu.txt - This file contains menu definition in text format using | as separator. - Can create menu up to three levels only. - Each menu item is divided in three parts 1. Look value id, 2. Menu Text Name to be displayed on web, 3. Link / url of the menu item. 2. menu_call.php - In this php code file we can pass css class name using $menu_class_name variable. - We have to define class if that class is not there we can change css definition or have new class there for each application. As each application will have new template and css. 3. main_menu.php - In this php page function / code is there to read text file and display in menu format. - User don't req. to change any code over here. ##Example of Menu Text File for One Level Menu: filename menulevel1.txt 791~Home~index.php||| 791~Services~services.php||| 788~AboutUs~about_us.php||| 789~Contact Us~contact_us.php||| ##Example of Menu Text File for Two Level Menu: filename menulevel2.txt 791~Home~index.php||| 791~Services~services.php||| 788~About Us~about_us.php||1190~Who We Are~about-us.php||1191~Strengths~about-us.php||| 789~Contact Us~contact_us.php||1194~Email~contact_us.php||1195~US New jersey~contact_us.php||1196~India Mumbai~contact_us.php||| ##Example of Menu Text File for Three Level Menu: filename menulevel3.txt 791~Home~index.php||740~Who We Are~|863~Test~about-us.php||741~Strengths~about-us.php|866~Demo~about-us.php||742~Milestone~about-us.php|869~Demo Test~about-us.php|| 851~Training~about-us.php|852~PHP~about-us.php||| 792~Services~services.php||743~Strategic Consulting~services.php|860~demo level1~services.php||744~Specialized Training SPTR~services.php|827~PMP Study Plus~services.php|828~Scrum Agile~services.php|833~Java (Intermidate to Advance)~services.php|837~PMP Online Course~services.php|838~CAPM Online Course~services.php||745~Sponsorship~services.php|872~Sponsor~services.php||| 788~About Us~about_us.php||1190~Who We Are~about-us.php||1191~Strengths~about-us.php||| ## Code Details ## #file name : #menu_call.php //path of menu txt file $text_file_path = 'menulevel1.txt'; //this variable for to pass classname to div $menu_class_name = 'menuheader2'; //main menu file in that main menu code for to add class name to div and design menu include('main_menu.php'); //css class sample code .menuheader1 li { float: left; position: relative; width: 100px; list-style: none; padding: 10px; } .menuheader1 ul ul { position: absolute; left: 0px; top: 80%; visibility: hidden; padding: 0px; } .menuheader1 ul ul ul { left: 100%; top: 0; } .menuheader1 li:hover > ul { visibility: visible; opacity: 1; background: #ecdede; }