6.6. Adding a Menu

Your blog should include a menu item that enables your users to get between the "Blog" and "About the Author" pages. Accomplishing this is a simple matter of adding a snippet of HTML to index.php below the main heading.

Open index.php in Eclipse and insert the HTML code in bold into the body of the page as indicated, just below the <h1> tag:

<body>

    <h1> Simple Blog Application </h1>
    <ul id="menu">
        <li><a href="/simple_blog/blog/">Blog</a></li>
        <li><a href="/simple_blog/about/">About the Author</a></li>
    </ul>

    <div id="entries">

Next, navigate to http://localhost/simple_blog/ to see the menu (see Figure 6-10).

Figure 6.10. Your blog application with a menu in place

Get PHP for Absolute Beginners now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.