Best practices for creating a template...

Discussion in 'CSS' started by Darwyn, Mar 16, 2010.

  1. #1
    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?
     
    Darwyn, Mar 16, 2010 IP
  2. Darwyn

    Darwyn Peon

    Messages:
    34
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    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?
     
    Darwyn, Mar 17, 2010 IP
  3. sylverCode

    sylverCode Member

    Messages:
    74
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    43
    #3
    Just make copy the same html into a new page and make your changes?
     
    sylverCode, Mar 17, 2010 IP
  4. Darwyn

    Darwyn Peon

    Messages:
    34
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    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!
     
    Darwyn, Mar 17, 2010 IP
  5. sylverCode

    sylverCode Member

    Messages:
    74
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    43
    #5
    Use a CMS.
     
    sylverCode, Mar 17, 2010 IP
  6. Darwyn

    Darwyn Peon

    Messages:
    34
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    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.
     
    Darwyn, Mar 17, 2010 IP
  7. sylverCode

    sylverCode Member

    Messages:
    74
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    43
    #7
    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.
     
    sylverCode, Mar 17, 2010 IP
  8. psharma

    psharma Prominent Member

    Messages:
    1,955
    Likes Received:
    85
    Best Answers:
    4
    Trophy Points:
    345
    #8
    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.
     
    psharma, Mar 17, 2010 IP
  9. steelfrog

    steelfrog Peon

    Messages:
    537
    Likes Received:
    24
    Best Answers:
    0
    Trophy Points:
    0
    #9
    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.
     
    steelfrog, Mar 17, 2010 IP
  10. Darwyn

    Darwyn Peon

    Messages:
    34
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #10
    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.
     
    Darwyn, Mar 17, 2010 IP
  11. dezigno

    dezigno Peon

    Messages:
    8
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #11
    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.
     
    dezigno, Mar 20, 2010 IP
  12. adublin

    adublin Well-Known Member

    Messages:
    77
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    138
    #12
    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,
     
    adublin, Mar 20, 2010 IP
  13. yenerich

    yenerich Active Member

    Messages:
    697
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    75
    #13
    Yes, this is the answer.
    Thats the wat CMS works.
    Its a good practice, dont worry about that.
     
    yenerich, Mar 31, 2010 IP