problem in including java menu in each page

Discussion in 'PHP' started by sonumittal, Jun 5, 2008.

  1. #1
    hi
    i m new here....i wanna include menu in my each page....my web structure is
    new > main root dir for web having java menu files named head.php( i have used sothink menu generator java script to include menu in this php file, i have inluded java script in the head and body tag of this head.php file as told by the sothnik menu generator)
    1 > first folder
    2 > 2nd folder
    and so on .....
    my all web files in php arein main folder.......

    i ha
    if i include head.php in my php page in main folder using include, it includes ok and works ok ....but suppose my php page in any other folder like in 1 folder here, then inluding head.php
    give no menu in the page.....plz tell me how to do it............
     
    sonumittal, Jun 5, 2008 IP
  2. kmap

    kmap Well-Known Member

    Messages:
    2,215
    Likes Received:
    29
    Best Answers:
    2
    Trophy Points:
    135
    #2
    Use absolute referencing in the menu for pages

    Like

    yoursitename.com/abc.php instead of abc.php

    Will solve your problem

    Regards

    Alex
     
    kmap, Jun 5, 2008 IP
  3. sonumittal

    sonumittal Peon

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    but still it does not include the menu...........
    i think the link in the .js file are relative, so they are not included ..........
    so i have changed the relative paths to absolute paths....now all the menu is included but there is another problem now.......it is showing the menu but the links in the menu go to other addresses which does not exist.......for example......
    i have main.php and head.php containing my main page code and menu respectively in root dir ( root is my main root dir for web)....
    main.php > main page data except menu
    head.php > menu items...

    main.php file look like as

    <?php
    include "head.php";
    -----
    ----
    ?>

    head.php
    <?php
    ----
    <head>< type=css/text javascript .....></head>
    <title>aaa</title>
    <body>
    here is the java code supplied by the sothink menu generator...and in this, i have made the relative addresses absolutee addresses......
    </body>

    but now i have folder 1 in this main dir....i have profile.php file here which looks like this

    <?php
    include "../head.php";
    -----
    some links here....
    ----
    ----
    ?>

    whenever i clik on the link in this page, it searches for the file with address "//localhost/1/profile.php" which does not exist.....since the page in the main dir......
    and whenever i click in the main page for profile.php, it work fine since it looks for the file //localhost/profile.php

    so tell me wat to do.......

    tanks in advance.....
     
    sonumittal, Jun 5, 2008 IP