1. This website uses cookies. By continuing to use this website you are giving consent to cookies being used.
    For information on cookies and how you can disable them visit our Cookie Usage page.
    Dismiss Notice

PHP update the menu

Discussion in 'Web Development' started by djwilson, Dec 7, 2008.

  1. djwilson

    djwilson New Member

    Hi,

    on my new site: http://www.youtubedjchannel.com as you can see on the left hand side is two menus, i was wondering is there a way so that i copy the coding of it and paste it into a file that will update it all in one (insert the fileame path where the menu would be) and allow me to add a new page eg: Forums add the bottom of it or something?


    thanks, i really need this because soon i will have to edit over 300 files:mad:
     
  2. vareside

    vareside New Member

    Well, you can create a JS-file where you paste the menu in and then just let it be opened by the original html page viewed by the visitor. Then you'll just have to edit the single JS-file. The same thing works with PHP. But a server that accepts PHP is required for that.

    If your host allows PHP, you can add this to the location the menu should be displayed. But the extension of the file you are using the code in has to be .php !!!

    PHP:
    <?php include'editable-menu.php'?>
    Now you have to create the editable-menu.php file with the navigation in it.

    PHP:
    <?php 
    echo('<a href="#">your menu</a>');
    echo(
    '<table><tr><td>something</td><td>something else</td></tr></table>');
     
    ?>
    Just replace the rubbish between echo(' and '); with your html code.