PDA

View Full Version : Putting the Menu contents in an external file



lakkes
12-11-2015, 06:52 PM
Hello
I like the All Levels Navigational Menu (v4.1) http://www.dynamicdrive.com/dynamicindex1/ddlevelsmenu/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

Beverleyh
12-11-2015, 07:29 PM
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

lakkes
12-11-2015, 08:28 PM
Thank you for your answer
It is not possible to use something like this: http://www.dynamicdrive.com/dynamicindex1/drilldownmenu_suppliment.htm ?
or like this: http://www.dynamicdrive.com/dynamicindex1/ddsmoothmenu.htm#ajax ?

Beverleyh
12-11-2015, 11:21 PM
Possible, yes. But remember to include a fallback like second example does (alternative noscript content that links to a static sitemap)

lakkes
12-12-2015, 08:37 AM
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/dynamicindex1/ddlevelsmenu/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!

lakkes
12-12-2015, 09:27 AM
Also I try this command <script src="myscripts.js"></script>
But I don't know how to convert the menu http://www.dynamicdrive.com/dynamicindex1/ddlevelsmenu/index.htm to an *.js file...
If it is possible to help to this?

Beverleyh
12-12-2015, 04:39 PM
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/dynamicindex1/ddlevelsmenu/index.htm
Also you can give me an example from my siteI 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.