0

I'm new at HTML and need to do a simple site as an assignment. For the site navigation menu I guess it would be easy to simply copy and paste the navigation menu HTML onto all the pages in a header div. But is there a better way to do this?

for example, is there an easy way (that doesn't require scripting) to only write the code in one place and have it included on every page? I remember that I did something in Dreamweaver that created a template page that included the navigation menu. However I have a feeling that that was just copying html between pages.

Zach Smith
  • 8,458
  • 13
  • 59
  • 133
  • 2
    You're right about Dreamweaver, it's copying. You can't do this in pure HTML. – jwatts1980 Mar 14 '14 at 01:45
  • 1
    You could use an `iframe` like it's 1999, but you're eyes may start to burn once you realize what that'll look like. – Bob Shannon Mar 14 '14 at 01:48
  • i'll avoid that thanks :) – Zach Smith Mar 14 '14 at 01:50
  • 1
    I can't imagine a simple site for an assignment is going to be particularly complicated. However, this is a really good excuse to learn some basic PHP :) – misterManSam Mar 14 '14 at 02:00
  • No. Nada. Zip. Zilch. You need to script it. You can template this type of thing in numerous languages and very simply. – nickhar Mar 14 '14 at 02:01
  • @misterManSam. It isn't very complicated. just a static website with a drop down menu and some javascript (not jQuery) highlighting. is this not possible using client side javascript? – Zach Smith Mar 14 '14 at 02:23
  • 2
    You can input HTML using javascript. But no! Don't use it for a menu! Server side is the only way to go with this :) – misterManSam Mar 14 '14 at 02:42
  • 1
    Well Google does apparently execute javascript these days, **results may vary and this does not apply to all search engines**. Similar (old) question [HERE](http://stackoverflow.com/questions/1304058/javascript-seo). Now, although most users these days will have javascript enabled, this should not be assumed and fallbacks should be in place where possible. Javascript is meant to enhance the user experience and not be completely relied upon. Also, tech savy users may have browser extenstions such as `noscript` which block javascript by default. If they don't see your menu, why return? – misterManSam Mar 14 '14 at 05:29

2 Answers2

1

Without scripting your HTML files will need to contain the menubar in full.

You are describing what a server side scripting language can do. Without one - your HTML files are served as they are. Therefore they must contain the HTML for the menubar within them.

The comments mention using an iframe - though very creative - I believe it doesn't satisfy as being "a better way to do this"

tchow002
  • 1,068
  • 6
  • 8
0

You have must use HTML code every page without HTML does't work Try to learn some basic PHP it will help

Kondal
  • 2,870
  • 5
  • 26
  • 40