This has been posted in the CSS forum, but perhaps that was not the appropriate place for it, so here it is again... Hello, Using CSS and div tags, I've created the main page for a site I am working on. I now need to create sub pages based on this main page (same header and footer). What is the best way to do this? I've used Dreamweaver as my html editor and can save the file as a .dwt file and insert editable regions. But is that the best way? or is it using a <?php include (contact.html) ?> function? Are there other ways?
I have used this in the past. Create a file called contactInfo.js and put this code in it. var myContactInfo = "<p>MyName</p><p>MyPhone</p><p>MyEmail</p>"; document.getElementById("contactInfo").innerHTML = myContactInfo; Create a file called contactInfo.html and put this code in it. <div id="footer"> <div id="nav-contactInfo"></div> <script language="JavaScript" src="contactInfo.js"></script> </div> Bring up the html file in your browser. So basically using Javascript you can create a client side include to store global information for all your pages.
the moment Dreamweaver is involved it's NEVER the best way - since not only are all the code examples they have decade or more out of date, and not only is the WYSIWYG side total trash, the comments they use to mark your insertable regions can trip rendering errors in IE. (YES, I SAID COMMENTS can trip rendering errors in IE) Step one, do yourself a HUGE favor and toss that buggy bloated mess of Adobe crap in the trash, and go get yourself a flat text editor like Notepad++, EditPlus or Crimson editor. Step two, go with the php includes. It's more versatile, and starts you on the path of being able to do even more powerful site building.