Results 1 to 7 of 7

Thread: Putting the Menu contents in an external file

  1. #1
    Join Date
    Dec 2015
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Putting the Menu contents in an external file

    Hello
    I like the All Levels Navigational Menu (v4.1) http://www.dynamicdrive.com/dynamici...menu/index.htm
    But I would like some help!!
    I need to write the HTML for the top menu bar and for each drop down menu to a *.js or *.txt or *.htm file because else I must writting the same code to every page of my site...
    And when I want to add something or change something I must update all the pages!!!
    With the *.js file you can do the update only one time to the external file
    Please if it is possible to give me some examples...
    1 How to write the external file
    2 Where and how write in my page the script to refer to the external file
    This is my site www.silentexplorers.info
    Maybe if you see my site you will understand what I want to do with the menu
    Thank you for your time
    Best regards
    Ioannis
    Last edited by Beverleyh; 12-11-2015 at 07:03 PM.

  2. #2
    Join Date
    Jul 2008
    Location
    Derbyshire, UK
    Posts
    3,033
    Thanks
    25
    Thanked 599 Times in 575 Posts
    Blog Entries
    40

    Default

    Including critical content, such as a menu, is better done using a server-side approach (see the PHP include link below). Doing it client-side with JavaScript will leave your site menu-less if the JavaScript fails to load for whatever reason (local blocking/firewalls, network errors, in-browser errors from 3rd party add-ons, custom settings, disabling, assistive softwares/screen-readers, etc).

    If you are able to use PHP instead try this tutorial http://www.tizag.com/phpT/include.php
    Focus on Function Web Design
    Fast Edit (A flat file, PHP web page editor & CMS. Small, FREE, no database!) | Fast Edit BE (Snippet Manager) (Web content editor for multiple editable regions!) | Fast Apps

  3. #3
    Join Date
    Dec 2015
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thank you for your answer
    It is not possible to use something like this: http://www.dynamicdrive.com/dynamici...suppliment.htm ?
    or like this: http://www.dynamicdrive.com/dynamici...hmenu.htm#ajax ?

  4. #4
    Join Date
    Jul 2008
    Location
    Derbyshire, UK
    Posts
    3,033
    Thanks
    25
    Thanked 599 Times in 575 Posts
    Blog Entries
    40

    Default

    Possible, yes. But remember to include a fallback like second example does (alternative noscript content that links to a static sitemap)
    Focus on Function Web Design
    Fast Edit (A flat file, PHP web page editor & CMS. Small, FREE, no database!) | Fast Edit BE (Snippet Manager) (Web content editor for multiple editable regions!) | Fast Apps

  5. #5
    Join Date
    Dec 2015
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    I am sorry but I can not understand...
    Can you please give me an example?
    Try please with the menu I like, the All Levels Navigational Menu (v4.1) http://www.dynamicdrive.com/dynamici...menu/index.htm
    Also you can give me an example from my http://www.silentexplorers.info
    You can see the source and the reason I want put the menu at an external file
    My menu is to big and if I want to change something or update, I must do it to all my pages....
    thank you for your time!
    Last edited by Beverleyh; 12-12-2015 at 04:18 PM.

  6. #6
    Join Date
    Dec 2015
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Also I try this command <script src="myscripts.js"></script>
    But I don't know how to convert the menu http://www.dynamicdrive.com/dynamici...menu/index.htm to an *.js file...
    If it is possible to help to this?

  7. #7
    Join Date
    Jul 2008
    Location
    Derbyshire, UK
    Posts
    3,033
    Thanks
    25
    Thanked 599 Times in 575 Posts
    Blog Entries
    40

    Default

    Can you please give me an example?
    Try please with the menu I like, the All Levels Navigational Menu (v4.1) http://www.dynamicdrive.com/dynamici...menu/index.htm
    Also you can give me an example from my site
    I think you have the wrong idea about this forum. It isn't a place where developers are on hand to write your code for you based on your brief. If you want somebody to do the work for you, consider hiring somebody. We can give you suggestions/modifications based on *your code* though, so try Googling for examples and tutorials and attempt what you're asking for yourself first.

    Examples to get you started https://www.google.co.uk/search?q=include+txt+file+ajax

    Please post back with your code examples if you need further assistance.
    Last edited by Beverleyh; 12-12-2015 at 05:31 PM. Reason: Starter link added
    Focus on Function Web Design
    Fast Edit (A flat file, PHP web page editor & CMS. Small, FREE, no database!) | Fast Edit BE (Snippet Manager) (Web content editor for multiple editable regions!) | Fast Apps

Similar Threads

  1. i see sometimes in contents of sitemap menu like a tree file system
    By lse123 in forum Looking for such a script or service
    Replies: 3
    Last Post: 06-10-2013, 05:46 PM
  2. Putting All Levels Nav Menu in a Javascript file?
    By macarthur in forum Dynamic Drive scripts help
    Replies: 5
    Last Post: 01-19-2013, 07:41 AM
  3. Chain select script with contents called from an external file
    By Dazza30 in forum Looking for such a script or service
    Replies: 1
    Last Post: 10-05-2011, 12:57 PM
  4. Replies: 3
    Last Post: 07-28-2011, 07:21 PM
  5. Menu in an external file
    By anihee in forum Dynamic Drive scripts help
    Replies: 2
    Last Post: 09-15-2007, 04:46 PM

Bookmarks

Posting Permissions

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