Results 1 to 37 of 37

Thread: Need Help with PHP menu
      
   

  1. #1
    jamslive is offline First Lieutenant
    Join Date
    May 2007
    Posts
    168

    Question Need Help with PHP menu

    hi
    1 - i'm using php code for attaching multiple page with one menu.
    in the menu page - <? function menu() { ?>
    end of page
    <?
    }
    ?>

    in the the page calling the menu - <?php
    include ("menu.php");
    menu();
    ?>

    - lets say that the page locate at /public_html/my domain/test/test1
    and the menu is at /public_html/my domain

    my qustion is - how to change the php code to call the menu frome the root?

    thank you
    domain name - free-sharing.com
    James Acobas

  2. #2
    Vasili's Avatar
    Vasili is online now Moderator
    Join Date
    Mar 2006
    Posts
    13,610

    Arrow Re: heeeelp please with php menu

    Thread Moved To Proper Forum

  3. #3
    Join Date
    Feb 2006
    Location
    Earth
    Posts
    8,721

  4. #4
    jamslive is offline First Lieutenant
    Join Date
    May 2007
    Posts
    168

    Default Re: Need Help with PHP menu

    I read the instruction and i get this notice when publishing the files:
    "Fatal error: Call to undefined function menu() in /home/my_username/public_html/you10/Products/index.php on line 4"

    *. link to the menu file - http://you10.net/menu.php
    the code at start of page -
    <? function menu() { ?>
    at the end
    <?
    }
    ?>

    *. link to page including the menu file - http://you10.net/Products
    the code is - <?
    $file_to_include = $_SERVER['DOCUMENT_ROOT']."/home/my_username/public_html/you10/menu.php";
    include($file_to_include);
    menu();
    ?>


    please - where is my mistake?

    thank you
    James Acobas

  5. #5
    Karen Mac's Avatar
    Karen Mac is offline General
    Join Date
    Apr 2006
    Location
    X marks the spot
    Posts
    8,353

    Default Re: Need Help with PHP menu

    on the page you want the menu to appear try simply using this

    <?
    include('menu.html');
    ?>
    in an html box

    The other code goes on the page with the menu on it all by itself.

    Karen

    VodaHost

    Your Website People!
    1-302-283-3777 North America / International
    07031847328 / United Kingdom

    ------------------------

    Top 3 Best Sellers

    Web Hosting - Unlimited disk space & bandwidth.

    Reseller Hosting - Start your own web hosting business.

    Search Engine & Directory Submission - 300 directories + (Google,Yahoo,Bing)



  6. #6
    jamslive is offline First Lieutenant
    Join Date
    May 2007
    Posts
    168

    Default Re: Need Help with PHP menu

    i tried this code and its work well if we calling the menu from the same folder, but i want to call the menu from another folder..
    thank you
    James Acobas

  7. #7
    Join Date
    Mar 2006
    Location
    Mallorca, Spain
    Posts
    6,313

    Default Re: Need Help with PHP menu

    depending on how many folders you have, the simple answer is to copy the menu page to the other folders.

  8. #8
    jamslive is offline First Lieutenant
    Join Date
    May 2007
    Posts
    168

    Default Re: Need Help with PHP menu

    I have many folders
    James Acobas

  9. #9
    Join Date
    Feb 2006
    Location
    Earth
    Posts
    8,721

    Default Re: Need Help with PHP menu

    If your main munu is in the public_html area, the link to the post above should work fine.

    <?
    $file_to_include = $_SERVER['DOCUMENT_ROOT']."/include_path/menu.php";
    include($file_to_include);
    menu();
    ?>



    .

  10. #10
    jamslive is offline First Lieutenant
    Join Date
    May 2007
    Posts
    168

    Default Re: Need Help with PHP menu

    i have severals domains on my server, so for every domain i have different folder in my public html.
    i specify the locations needed top above.

    thank you
    James Acobas

  11. #11
    Join Date
    Mar 2006
    Location
    Mallorca, Spain
    Posts
    6,313

    Default Re: Need Help with PHP menu

    This is the corect code:

    If the menu is in your public_html folder then leave out the "include_path"

    <?
    $file_to_include = $_SERVER['DOCUMENT_ROOT']."/menu.php";
    include($file_to_include);
    menu();
    ?>

  12. #12
    jamslive is offline First Lieutenant
    Join Date
    May 2007
    Posts
    168

    Default Re: Need Help with PHP menu

    my menu is not at the public_html folder.
    please see top above

    thank you
    James Acobas

  13. #13
    Join Date
    Mar 2006
    Location
    Mallorca, Spain
    Posts
    6,313

    Default Re: Need Help with PHP menu

    Quote Originally Posted by davidundalicia View Post
    This is the corect code:

    If the menu is in your public_html folder then leave out the "include_path"

    <?
    $file_to_include = $_SERVER['DOCUMENT_ROOT']."/menu.php";
    include($file_to_include);
    menu();
    ?>
    Well please put it there and the above will work...............

  14. #14
    Join Date
    Mar 2006
    Location
    Mallorca, Spain
    Posts
    6,313

    Default Re: Need Help with PHP menu

    Quote Originally Posted by jamslive View Post

    - lets say that the page locate at /public_html/my domain/test/test1
    and the menu is at /public_html/my domain

    my qustion is - how to change the php code to call the menu frome the root?

    thank you
    domain name - free-sharing.com
    [/SIZE]
    And here is the code from the root:

    <?
    include('menu.html');
    ?>



    <?
    $file_to_include = $_SERVER['DOCUMENT_ROOT']."/include_path/menu.html";
    include($file_to_include);
    ?>

    Extracted from a post by Navaldesign: and mentioned by Chris:

  15. #15
    jamslive is offline First Lieutenant
    Join Date
    May 2007
    Posts
    168

    Default Re: Need Help with PHP menu

    the code now as you suggested-for the path public_html/you10...
    <?
    $file_to_include = $_SERVER['DOCUMENT_ROOT']."/you10/menu.php";
    include($file_to_include);
    menu();
    ?>
    i get the same result
    thank you
    James Acobas

  16. #16
    Join Date
    Mar 2006
    Location
    Mallorca, Spain
    Posts
    6,313

    Default Re: Need Help with PHP menu

    Menu page code - page html - start of page

    <? function ppmenu() { ?>

    End of page

    <?
    }
    ?>

    Page code in html box

    <?
    $file_to_include = $_SERVER['DOCUMENT_ROOT']."/ppmenu.php";
    include($file_to_include);
    ppmenu();
    ?>

    Please note that I DID NOT include the folder at the end.........
    The menu page is in my public directory
    and the page is in another folder.

    If you code correctly, you will get the correct result.

    The above has been run and tested OK

  17. #17
    jamslive is offline First Lieutenant
    Join Date
    May 2007
    Posts
    168

    Default Re: Need Help with PHP menu

    Mr david
    i dont want to use my public html folder as source of menues.
    as i said, i have several domains on my server and every domain has a different folder, it's will not be comfortable to use the root folder for...
    i want to use the root folder associat with the domain - /public_html/domain_name/menu.php

    for your last suggest above ,in the public_html its work well...
    thank you
    James Acobas

  18. #18
    Join Date
    Mar 2006
    Location
    Mallorca, Spain
    Posts
    6,313

    Default Re: Need Help with PHP menu

    James, please call me david.

    Unless you have more than one account, then you will only have one public_html directory/folder

    I have 20 or so different domains and each domain has many different folders
    and I use the sytem that I have shown You without any problems.

    I have many different menues and all I do is change the menu name as you might have noticed above.

    good luck with your site.

  19. #19
    jamslive is offline First Lieutenant
    Join Date
    May 2007
    Posts
    168

    Default Re: Need Help with PHP menu

    David
    now its work but i cant see the image? test menu
    you have an idea for this problem?

    i noticed that in the source html code of the page that call the menu,asking the image from the same folder that the page are.

    <img src="bv01239.gif"


    thank you
    James Acobas

  20. #20
    Join Date
    Mar 2006
    Location
    Mallorca, Spain
    Posts
    6,313

    Default Re: Need Help with PHP menu

    I have had a look at the test page and links are working OK, but what image are you referring to ?&#191;

  21. #21
    jamslive is offline First Lieutenant
    Join Date
    May 2007
    Posts
    168

    Default Re: Need Help with PHP menu

    its Bv shapes feture located on the menu page
    thank you
    James Acobas

  22. #22
    Join Date
    Feb 2006
    Location
    Earth
    Posts
    8,721

    Default Re: Need Help with PHP menu

    Hi, its working here http://you10.net/bv01239.gif (1 directory down) But might be worth seeing if the site is enabled under hot link protection in your cpanel.

  23. #23
    jamslive is offline First Lieutenant
    Join Date
    May 2007
    Posts
    168

    Default Re: Need Help with PHP menu

    hi and thank you
    will you be kind to explain the " hot link protection " issue ?
    and how i can solve it?

    * - i understand that the page calling the menu from (1 directory down)
    but how can we tell the codet to upload the image from 1 or 2 down directory ?

    thank you
    James Acobas

  24. #24
    navaldesign's Avatar
    navaldesign is offline General & Forum Moderator
    Join Date
    Oct 2005
    Location
    Italy
    Posts
    12,115

    Default Re: Need Help with PHP menu

    When the menu page also has an image, the same considerations (regarding the menu itself) are also valid for the images.

    Let's suppose that you have published the menu in your public_html/domain_name/foldername (IF you publish in a subfolder)

    Publish the menu page. This way, the image is also uploaded.

    Then, go back in BV and insert an Image object in your page. Make it the same dimensions as the shape, and in the source field of the dialog box insert :
    <? echo $_SERVER["DOCUMENT_ROOT"]."/foldername/bv01239.gif";?>

    Publish again.

    At this point you should be done.
    Navaldesign
    Logger Lite: Low Cost, Customizable, multifeatured Login script
    Instant Download Cart: a Powerfull, Customized, in site, DB driven, e-products Cart
    DBTechnosystems.com Forms, Databases, Shopping Carts, Instant Download Carts, Loggin Systems and more....
    Advanced BlueVoda Form Processor : No coding form processor! Just install and use! Now with built in CAPTCHA!


  25. #25
    jamslive is offline First Lieutenant
    Join Date
    May 2007
    Posts
    168

    Default Re: Need Help with PHP menu

    i think i saw somewhere in the forum, your instraction about the simple way to use the php menu code from the same folder.
    i think the main idea is to use it and it will be comfortable changing in the future.
    if i use Bv nevigation bar menu (image for every button)- its a lot of work to customize the menu page - more than that i think when i will need to change the menu page ,it's will take alot of time.????

    thank you
    James Acobas

  26. #26
    Join Date
    Mar 2006
    Location
    Mallorca, Spain
    Posts
    6,313

  27. #27
    navaldesign's Avatar
    navaldesign is offline General & Forum Moderator
    Join Date
    Oct 2005
    Location
    Italy
    Posts
    12,115

    Default Re: Need Help with PHP menu

    Your best bet is to publish the menu in the same folder(s) as the pages that are using it.

    In this case, publish the menu page as html (in example : menu.html)
    and make this VERY simple include code:

    <?
    include 'menu.html';
    ?>

    And you are done.
    Navaldesign
    Logger Lite: Low Cost, Customizable, multifeatured Login script
    Instant Download Cart: a Powerfull, Customized, in site, DB driven, e-products Cart
    DBTechnosystems.com Forms, Databases, Shopping Carts, Instant Download Carts, Loggin Systems and more....
    Advanced BlueVoda Form Processor : No coding form processor! Just install and use! Now with built in CAPTCHA!


  28. #28
    jamslive is offline First Lieutenant
    Join Date
    May 2007
    Posts
    168

    Default Re: Need Help with PHP menu

    thank you very much (David,vasili and naval).wonderful job
    for helping me solve this php menu issue.
    i used that code supplied by David-
    Menu page code - page html - start of page

    <? function ppmenu() { ?>

    End of page

    <?
    }
    ?>

    Page code in html box

    <?
    $file_to_include = $_SERVER['DOCUMENT_ROOT']."/ppmenu.php";
    include($file_to_include);
    ppmenu();
    ?>
    its work fine in different folder but i customized the menu just with HTML elements
    NO images,NO shpes

    thank you
    James Acobas

  29. #29
    jamslive is offline First Lieutenant
    Join Date
    May 2007
    Posts
    168

    Default Re: Need Help with PHP menu

    some one can help me with this instruction?
    because its dose'nt work for me or maybe i didnt understand what exactly to do

    Quote Originally Posted by jamslive View Post
    thank you very much (David,vasili and naval).wonderful job
    for helping me solve this php menu issue.
    i used that code supplied by David-
    Menu page code - page html - start of page

    <? function ppmenu() { ?>

    End of page

    <?
    }
    ?>

    Page code in html box

    <?
    $file_to_include = $_SERVER['DOCUMENT_ROOT']."/ppmenu.php";
    include($file_to_include);
    ppmenu();
    ?>
    its work fine in different folder but i customized the menu just with HTML elements
    NO images,NO shpes

    thank you
    thank you
    James Acobas

  30. #30
    navaldesign's Avatar
    navaldesign is offline General & Forum Moderator
    Join Date
    Oct 2005
    Location
    Italy
    Posts
    12,115

    Default Re: Need Help with PHP menu

    Your best bet is to publish the menu in the same folder(s) as the pages that are using it.

    In this case, publish the menu page as html (in example : ppmenu.html).

    Do NOT place any code in the ppmenu page (if you already have some, REMOVE it)

    Then use this VERY simple include code in your pages:

    <?
    include 'ppmenu.html';
    ?>

    And you are done.
    Navaldesign
    Logger Lite: Low Cost, Customizable, multifeatured Login script
    Instant Download Cart: a Powerfull, Customized, in site, DB driven, e-products Cart
    DBTechnosystems.com Forms, Databases, Shopping Carts, Instant Download Carts, Loggin Systems and more....
    Advanced BlueVoda Form Processor : No coding form processor! Just install and use! Now with built in CAPTCHA!


  31. #31
    jamslive is offline First Lieutenant
    Join Date
    May 2007
    Posts
    168

    Default Re: Need Help with PHP menu

    thank you Sir

    i thought that the all idea with "menu include" is to save customizing in the future and with the simple code i will have to work very hard to change it .
    my site includes 1200 pages with many folders...
    now all my pages with that code
    " <?
    $file_to_include = $_SERVER['DOCUMENT_ROOT']."/ppmenu.php";
    include($file_to_include);
    ppmenu();
    ?> "
    James Acobas

  32. #32
    jamslive is offline First Lieutenant
    Join Date
    May 2007
    Posts
    168

    Default Re: Need Help with PHP menu

    heelp please
    James Acobas

  33. #33
    navaldesign's Avatar
    navaldesign is offline General & Forum Moderator
    Join Date
    Oct 2005
    Location
    Italy
    Posts
    12,115

    Default Re: Need Help with PHP menu

    Please follow these steps:

    1. Create a folder in your public_html, called "includes"
    2. Publish the menu in this folder. Do NOT add ANY code at all in the menu page. For this example, i will suppose that your page is "ppmenu.php".
    3. In the (1200!) pages, add this code in the html box:

    <?
    include '/home/cpusername/public_html/includes/ppmenu.php';
    ?>

    That's all.

    Please note that the include methid can NOT display images, so if you have a BV nav bar, which uses buttons (images), those will not appear if the menu is called from another folder. There is a remedy to this, by handcoding the menu page and making the image paths absolute URLs.

    Since i consider this to be hard for users without cosing experience, i believe that the solution of publishing the menu page in 10 or 20 folders would not be that hard.

    If you insidt, take these steps, AFTER you have published the page:

    1. In your BV ppmenu page, right click the menu itself, and select HTML.
    2. Copy the menu code.
    3. Insert a html box (yes...) in the menu page. Double click it and paste the copied code in it.
    You will see the code contains the image paths, in fact it will be looking something like:

    <table border="0" cellpadding="0" cellspacing="0" id="NavigationBar1">
    <tr>
    <td align="left" valign="top" width="124" height="30"><a href=""><img id="bv01001" src="bv01001.gif" alt="" align="top" border="0" width="124" height="30"></a></td>
    </tr>
    <tr><td height="4"></td></tr><tr>
    <td align="left" valign="top" width="124" height="30"><a href=""><img id="bv01002" src="bv01002.gif" alt="" align="top" border="0" width="124" height="30"></a></td>
    </tr>
    <tr><td height="4"></td></tr><tr>
    <td align="left" valign="top" width="124" height="30"><a href=""><img id="bv01003" src="bv01003.gif" alt="" align="top" border="0" width="124" height="30"></a></td>
    </tr>
    <tr><td height="4"></td></tr><tr>
    <td align="left" valign="top" width="124" height="30"><a href=""><img id="bv01004" src="bv01004.gif" alt="" align="top" border="0" width="124" height="30"></a></td>
    </tr>
    </table>

    Wherever you see images, like src="bv01004.gif" replace the source path with:

    img id="bv01004" src="http://maindomain.com/includes/bv01004.gif"

    Note the standard added part in blue color. Of course, replace maindomain.com with the real main domain name.
    Navaldesign
    Logger Lite: Low Cost, Customizable, multifeatured Login script
    Instant Download Cart: a Powerfull, Customized, in site, DB driven, e-products Cart
    DBTechnosystems.com Forms, Databases, Shopping Carts, Instant Download Carts, Loggin Systems and more....
    Advanced BlueVoda Form Processor : No coding form processor! Just install and use! Now with built in CAPTCHA!


  34. #34
    Watdaflip's Avatar
    Watdaflip is offline Major General
    Join Date
    Sep 2005
    Location
    Cincinnati, Ohio
    Posts
    2,119

    Default Re: Need Help with PHP menu

    You can move the file behind your public html and it will still load

    You can upload it to say

    /home/cpanel_username/menu.php

    And then include that path...

    include("/home/cpanel_username/menu.php");

    Just make sure you change "cpanel_username" to your actual cpanel username.

    Note you will have to edit the image path and make sure it uses an absolute path, not just relative. But assuming you don't have any hotlink protection enabled you can include the same menu on all your sites and it will load the images off of one.

    Also if you did have your menu uploaded at
    /home/username/public_html/menu.php

    and wanted to load it at
    /home/username/public_html/new_folder/menu.php

    on files in the "new_folder" directory you can use
    include("../menu.php");
    and it will go back a directory (on for each ../, so you could do ../../../, etc) and look for menu.php

    Register/Login Script
    Do you use a Password Protected Directory? Need a way to allow users to make their own account, try my .htaccess Login Script

  35. #35
    myjaydee is offline First Sergeant
    Join Date
    Sep 2008
    Posts
    71

    Talking I'm going to throw my two cents in here. Might save someone a lot of grief.

    I've been trying to sort out my menu for months now as I'm building a large site, so tried most of the suggestions here and dozens of others from online. Found this thread and figured it just might work. I used Naval's suggestion.

    However, it does not work with javascript menus --- on it's own.

    ***************
    You need to upload the menu into each folder in the first instance in order to get the jsscript into the folder to read. Then delete the menu from each folder leaving behind the js file.

    It then seems to work brilliantly.

    I haven't found the same problem with other types of includes.

    **************************

    Fingers crossed I've got it right! Perhaps someone else can clarify this and then put a special thread out in order to help others out there?

  36. #36
    navaldesign's Avatar
    navaldesign is offline General & Forum Moderator
    Join Date
    Oct 2005
    Location
    Italy
    Posts
    12,115

    Default Re: Need Help with PHP menu

    Actually, if you include the js menu through a cal in the "head" of the menu page, you need to edit the path to be "/home/cpusername/public_html/js_path/jsname.js " other wise the js is not included. This is the reason you need to upload the js to each folder.

    If instead the js was INSIDE the page of the menu (as code) then it would be also included without further changes.
    Navaldesign
    Logger Lite: Low Cost, Customizable, multifeatured Login script
    Instant Download Cart: a Powerfull, Customized, in site, DB driven, e-products Cart
    DBTechnosystems.com Forms, Databases, Shopping Carts, Instant Download Carts, Loggin Systems and more....
    Advanced BlueVoda Form Processor : No coding form processor! Just install and use! Now with built in CAPTCHA!


  37. #37
    myjaydee is offline First Sergeant
    Join Date
    Sep 2008
    Posts
    71

    Default Re: Need Help with PHP menu

    Quote Originally Posted by navaldesign View Post
    Actually, if you include the js menu through a cal in the "head" of the menu page, you need to edit the path to be "/home/cpusername/public_html/js_path/jsname.js " other wise the js is not included. This is the reason you need to upload the js to each folder.

    If instead the js was INSIDE the page of the menu (as code) then it would be also included without further changes.

    Hi Naval,

    I know you replied to this a few days ago but just found it. I am using BlueVoda's own MenuBar for this and when I tried to copy the code into the menu page it came up with errors.

    Can you please explain the first option for me? It sounds interesting and that way I won't forget to add and subtract the menu from every directory. Thanks in advance.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49