There are lots of good arguments already about why templating is still useful despite CSS. I haven't seen the simplest, most direct, and one of the most important reasons said...

CSS controls how a section of a page looks, and where those sections go. It doesn't separate the content into those sections. I can use CSS to make a paragraph pretty, to put a sidebar down the right of my page, and to make my header big and bold in a pretty color. I can't use it to divide the content into multiple <p> tags, to assign the main content to the main page body and its sidebar info into my sidebar. That's templating work.

Specifically, before the last redesign of my website, I had a CGI that grabbed a story from a file, a sidebar from a different file, picked the interesting facts at the bottom of the sidebar randomly from a set of other files, and displayed it all using HTML and CSS. Next time I redesign, it'll be mostly static pages, but still generated through a template system (and probably a database for content next time instead of flat files).

Update: Fixed a spelling error and an accidental StudlyCaps usage.

Really late update (2008-09-25): added code tags around the <p> tag to fix the markup.


In reply to Re: Why use templates? by mr_mischief
in thread Why use templates? by BUU

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.