We can do the same thing with the plain old html and javascript.
But how?
First you need to create the site main layout using divs and give them unique ids.
<html>
<title>HTML Includes</title>
<script language="javascript" src="js/main.js"></script>
<script src="js/prototype.js" type="text/javascript"></script>
<script language="javascript" xml:space="preserve">
// <![CDATA[
Event.observe(window, 'load', loadCalls);
// ]]>
</script>
<link type="text/css" href="css/main.css" rel="stylesheet"/>
<body>
<div class="page-sizer">
<div class="header" id="header"></div>
<div><div class="leftMenu" id="leftMenu"></div><div class="content" id="content"></div></div>
<span style="clear:both;" />
<div class="footer" id="footer"></div>
</div>
</body>
</html>
Also you'r gonna need a javascript library like prototype, Jquary, YUI. You don't have to have the whole library to do this. You only needs to have the files to make an ajax call. I am going to use prototype for my example but using other libraries wouldn't make much difference. So what I simply do is to access each div element and fetch it's content from a separate file and fill them.
function loadCalls() {
//Load the pages one by one to the divs
loadPages('common-pages/footer.html','footer');
loadPages('common-pages/header.html','header');
loadPages('common-pages/leftMenu.html','leftMenu');
loadPages('content/default.html','content');
}
function loadPages(path,loadToId){
//IE cache the response when the request parameters are the same
//So We send a random parameter weith the request
var random = Math.floor(Math.random() * 2000);
new Ajax.Request(path+'?rand=' + random,
{
method:'get',
evalScripts: true,
parameters:{random:random},
onSuccess: function(transport) {
document.getElementById(loadToId).innerHTML = transport.responseText;
},
onFailure: function() {
setError('Problem with loading the file');
}
});
}
And from the menu file I am loading each page to the “content” div as follows.
<a onclick="loadPages('content/page01.html','content');">page1</a>
You can download the complete source code from here http://sites.google.com/site/chanaka3d/Home/html-include.zip?attredirects=0
Note: This method will not work in IE if you are not hosting it in a sever. But in Firefox it doesn't necessarily need a sever to work.
Comments
Abercrombie Fitch
clothing
Abercrombie Fitch
hoodile
ralph lauren shirts
Columbia
Jacket
north face jackets
spyder ski
jacket
polo shirts
polo shirt
spyder jackets
mens jacket
mens spyder jackets
spyder jackets for cheap
spyder ski jacket
womens spyder jackets
ralph lauren
spyder jackets cheap
spyder jackets for men
cheap spyder jackets
north face
jackets
discount spyder jacket
the north face
jacket
ralph lauren polo shirts on
sale
discount ralph lauren polo
shirts
ralph lauren shirts
ralph lauren polo discount
ralph lauren polo sale
ralph lauren
polo shirts
ralph lauren polo wholesale
north face jackets
north face jacket
Columbia
Jacket
ralph lauren jacket
Abercrombie Fitch hoodile
Abercrombie Fitch
clothing
abercrombie fitch
abercrombie
fitch
welcom to our store.