Need Help with PHP menu

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • jamslive
    First Lieutenant

    • May 2007
    • 168

    #31
    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

    Comment

    • jamslive
      First Lieutenant

      • May 2007
      • 168

      #32
      Re: Need Help with PHP menu

      heelp please
      James Acobas

      Comment

      • navaldesign
        General & Forum Moderator

        • Oct 2005
        • 12080

        #33
        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!

        Comment

        • Watdaflip
          Major General

          • Sep 2005
          • 2116

          #34
          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

          Comment

          • myjaydee
            First Sergeant

            • Sep 2008
            • 71

            #35
            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?

            Comment

            • navaldesign
              General & Forum Moderator

              • Oct 2005
              • 12080

              #36
              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!

              Comment

              • myjaydee
                First Sergeant

                • Sep 2008
                • 71

                #37
                Re: Need Help with PHP menu

                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.

                Comment

                Working...
                X