Thomas Hutton Thomas Hutton - 3 months ago 8
HTML Question

No Static Footer or Header

My company just bought out another company and I have to change some links on their site to point to our site. However, this site doesn't have a static footer or header (as in, each link is recreated on each HTML page). So instead of changing the necessary files (30+), is there any other way to do a sweeping change?

Thanks.

Answer

While there are several methods, the one that I would recommend would be to use a server side include file.

My recommendation would be to follow these steps, approximately:

  1. Copy the header / nav contents from one of your HTML files into a new PHP include file (called, for example, header.php).
  2. Edit each HTML file, removing the header / nav contents, and including the file - that would look something like this: <?php require_once 'header.php'; ?>
  3. Repeat for the footer, if that has "common" links and markup.

While this may take longer initially, the very first time you have to make any updates it will pay off.

Lastly, there are ways - if necessary - to (utilizing PHP) make the current nav item have an active class, etc. That's a bit of a stretch for this answer, but this answer may get you going in the right direction.

Comments