...Beauty, cleaning, DIY tips and more - free to join!
   Login   Contact us   Site map   Puzzle Club   Ask a question    Newsletter

My website is growing quickly. How can I store my menu in just one file, rather than having to update it across every single page when I make a change?

Answered by: Dan Moore, web design expert

Congratulations on having a website that is growing quickly - this is usually the sign of an active and popular site!

When you start off with a small site it is not so much of a chore changing a menu, but as a site grows this can become time consuming and impractical as you are experiencing.

Luckily there are a couple of simple ways of having your menu or template in just one location.

The method to do this is using an include file. There are two standard ways of doing this.

One is to use SSI or server side includes. Most servers are configured to accept these but if in doubt, check with your site host.

To use these files you simply place the common menu elements in a separate file, and save it. Then reference the file with the following:
<!--#include file="included.html" -->

The alternative is to use a language such as PHP to create server side includes. If your host supports PHP then you can again put the common elements in a file and then include them with code such as this:

include ("mymenu.html");

Back to Questions in the Web Design Section

Back to Ask the Expert home page