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?
Is this question not clear? Many of you reading this HAD to have created sub pages from some sort of template. What's the best way to do this? Let me rephrase this question...You've been hired to create a relatively small site...the client loves your initial design. Now you need to make OTHER pages based on this initial design. What is the best way to do this?
the problem there becomes when the site gets bigger and more pages are added. If I change a link on the main page, I'd then have to make that change to as many pages as there are. Is there a way that I can make a change once and have it update the rest of the pages? Thanks for the reply!
You mean like Drupal or Joomla? That's not an option for me...it's a custom site where the design has been finalized and the deadline near. I can't afford to mess with either of those due to time constraints. In the past, I've used editable regions in Dreamweaver...but I know that cannot be the best practice for this.
Well, by using PHP the way you wanted is basically making a custom CMS. I think that since the site is small, you can get away with duplicating html.
calling the changed part of the page every time is good. if you will use ajax it will look brilliant because it will not take any time to switch between the pages.
I love AJAX, but that's not SEO friendly, nor is it user friendly. People expect the page to 'reload' and move when a link is clicked. Anyway, the PHP server-side include method you've mentioned above will work just fine to call shared elements like the header, footer and sidebars. I'd avoid using Dreamweaver's.
hmmm...not familiar enough with AJAX to utilize it. However, thank you everyone who responded! I was able to figure it out finally by using Server Side Includes (SSI). Just for reference, here is how I did it... I created my design in photoshop. When the client liked the design, I then translated my photoshop file into html using strictly CSS and DIV tags. The index.html page was complete. But then I needed to create other pages based on that design. So I broke apart my header, footer and the main content of the page into three separate HTML files. Using SSI, here is the final template: <body> <div id="main"> <div id="content"> <!--#include file="header.html" --> <!--#include file="main.html" --> </div> </div> <!--#include file="footer.html" --> </body> Now all I need to do is create my content in a separate HTML document, open this file and replace "main.html" with the new HTML file.
easiest way is to just keep using the same page and just renaming it e.g. index.html, aboutus.html, contact.html then just edit the pages. Or you could do, PHP Inlcudes, iFrames, or Ajax.
Darwyn - I think what your looking for is a best practice. Most developers I know, including myself, use Includes.... you really can't go wrong with it. Hope this helps,