• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 476
  • Last Modified:

Common content shared between html pages

On a static page site what is the best way of sharing common page areas, say like the page top & bottom, between pages?

A long time in the past I used frames but later found that they were not so good for search engines.

I have also used inline scripting where you set up in each page a link to some common javascript and then with the document body you declare a script section that calls a javascript function pagetop() located in the common scripts.

The pagetop function uses document.write(myhtml) to output the html required for the common areas.

Are there other approaches which are better?


  • 2
  • 2
  • 2
1 Solution
If you use an application such as Adobe Dreamweaver it offers site management tools which allow you to create library items ( such as a page header / footer / etc ) which you can embed into each page.

When you change those items it updates your entire site.
( and all of your pages will be HTML / contain all the code )

Trial version of dreamweaver if you want to try it out:

Dreamweaver Features:

There are other similar applications which do this but that is my personal favorite for managing sites.
You can also create page Templates which will allow you to have preset pages for each time you start a new one with all of the header / sidebar / footer content you need there...

If you use PHP, it's pretty easy.  You can turn any HTML file into a php file by changing the extension.  Then lets say you have some content that you want to have on multiple pages... ex: site navigation:

<ul id="siteNav">
  <li><a href="/page-1.php">Page 1</a></li>
  <li><a href="/page-2.php">Page 2</a></li>
  <li><a href="/page-3.php">Page 3</a></li>

Open in new window

You would take that and put it in a PHP file so that your PHP file would have nothing except for that  code.  Call the file "site-nav.php" and save it in the root of your website.

Then, in your different pages on your site, you can put the following line of code:

<div id="content">
<!-- Put your page content here -->
Lorem Ipsum


Open in new window

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

inthedarkAuthor Commented:
Thanks for the suggestions.  If I go the Designbyonyx suggestion and take the  php route how can I edit the old MyPage.html page to do a permanent redirect to MyPage.php?
there are a couple of options.  The best is probably to use your .htaccess file (google it).  You should be able to use the following:

RewriteEngine on
RewriteRule ^(.*)\.html $1\.php

This will redirect everything with an HTML extension to the same file with a PHP extension.
inthedarkAuthor Commented:
Sorry for delay

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 2
  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now