poet poet - 1 year ago 105
HTML Question

Repeat same HTML code in several pages

I have a really hard time searching for this, because I have no idea how to call it.

I'll try to describe the process I want, and see if any of you know such an editor.
I have a website that has the same html component repeated in them, for example, a menu. I can define how the menu looks with css, but I can't (as far as I know) add the same piece of html to every html page with a simple line.
What I do, is copy the menu over to every place. If I change the menu, I need to do it all again.
I know this can be achieved by using a dynamic server, with something like php or jsp, but I don't need it to be dynamic.

I was wondering if there was a way to do this.
I thought possibly there was an editor, where I can edit html using includes, and then "compile" the htmls after modification to produce the htmls I will replace on my server.


Answer Source

Have a look at server side includes ... create a menu.shtml page and then include it like so :

<!--#include virtual="/menu.shtml" -->

Its supported by most web servers out of the box (including IIS, Apache and lighttpd)

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download