Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <section class = "menu">
- <?php
- // function display_menu()
- // {
- $menu = Array(
- "1" => Array (
- "title" => 'Add task',
- "page" => 'add_task',
- "url" => "add_task.php",
- 'children' => Array()
- ),
- "2" => Array (
- "title" => "Today",
- "page" => 'today',
- "url" => "main_page.php",
- 'children' => Array()
- ),
- "3" => Array (
- "title" => 'Week',
- "page" => 'week',
- "url" => "" ,
- 'children' => Array()
- ),
- "4" => Array (
- "title" => 'Show all',
- "page" => 'show all',
- "url" => "",
- "children" => Array(
- "1" =>
- Array (
- 'title' => 'Categories',
- 'url' => 'index.php',
- 'children' => Array(
- "1" =>
- Array (
- 'title' => 'Work',
- 'url' => 'index.php',
- 'children' => Array(),
- ),
- "2" =>
- Array (
- 'title' => 'House',
- 'url' => 'index.php',
- 'children' => Array(),
- ),
- "3" =>
- Array (
- 'title' => 'Education',
- 'url' => 'index.php',
- 'children' => Array(),
- ),
- "4" =>
- Array (
- 'title' => 'Entertainment',
- 'url' => 'index.php',
- 'children' => Array(),
- ),
- "5" =>
- Array (
- 'title' => 'Other',
- 'url' => 'index.php',
- 'children' => Array(),
- ),
- ),
- ),
- "2" => Array (
- 'title' => 'Frequently used tags',
- 'url' => 'index.php',
- 'children' => Array(
- "1" =>
- Array (
- 'title' => 'Work',
- 'url' => 'index.php',
- 'children' => Array(),
- ),
- "2" =>
- Array (
- 'title' => 'House',
- 'url' => 'index.php',
- 'children' => Array(),
- ),
- "3" =>
- Array (
- 'title' => 'Education',
- 'url' => 'index.php',
- 'children' => Array(),
- ),
- "4" =>
- Array (
- 'title' => 'Entertainment',
- 'url' => 'index.php',
- 'children' => Array(),
- ),
- ),
- ),
- ),
- ),
- "5" => Array (
- "title" => 'Tags',
- "page" => 'tags',
- "url" => ""
- ),
- "6" => Array (
- "title" => 'Settings',
- "page" => 'settings',
- "url" => ""
- ),
- "7" => Array (
- "title" => 'About us',
- "page" => 'about',
- "url" => "about.php"
- )
- );
- function buildMenu($makemenu)
- {
- echo "<nav>";
- echo "<ul>";
- //echo count($menu);
- for ($i = 1; $i <= count($makemenu); $i++)
- {
- echo '<li><a href= ' . $makemenu[$i]['url'] . '>' . $makemenu[$i]['title'] .'</a>';
- if ( ! empty($makemenu[$i]['children'])) {
- echo "<ul>";
- buildMenu($makemenu[$i]['children']);
- echo "</ul>";
- }
- echo "</li>";
- }
- echo "</ul>";
- echo "</nav>";
- }
- echo buildMenu($menu);
- //}
- ?>
- </section>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement