centralize html menu with includes

Out of context: Reply #9

  • Started
  • Last post
  • 11 Responses
  • bort0

    Okay. First off, thanks for the help.

    Here's what I have in my root index.php
    <?php include ('includes/main_nav.php'); ?>

    Here's what I have in my about sub directory page about.php (1 level removed from the root)
    <?php include ('../includes/main_nav.php'); ?>

    Here's the main_nav.php file
    <ul id="menu">
    <li><a href="/about/about.php">About us</a>
    <ul class="drop">
    <li><a href="/about/what-we-do.php">What we do</a></li>
    </ul>

    Thing is, when I try and go from About us to What we do, I get this path instead: root/about/about/what-we-do.php

    when really what I should be getting is

    root/about/what-we-do.php

    Does every file have to be in a separate folder or something?

View thread