Greetings all,
Some good comments up to now. I do CGI based scripting almost exclusively and this is indeed a common issue for me and my team. However what we try to keep in mind is that a total seperation of logic from display is not always possible, especially with web-based applications. Our strategy is to utilize other technologies to help bridge the gap such as CSS or JavaScript. Standardizing styles can go a long way in terms of helping the programmers conform to the designers sense of style.
We usually define styles for HTML tags first, stuff like body, td, p, dir, blockquote, ...etc Then define custom styles (but standardized names!) for things like navigation links and any other funky stuff we need. This way if you forget the name of the custom style to use at least you will have a default style for most of your HTML tags and missings a style wont result in a non-conforming element.
It still boils down to you creating some HTML strings as you mentioned earlier, however you will now have a standard set of styles to work with. This way if your code ever needs a face lift you wont have to touch your code as much, just update the HTML templates and tweek the style sheet, so long as your style names stay the same you will be fine.
I know this is not the best of solutions but its better than hard-coding style related things in your scripts.

-injunjoel

In reply to Re: Code and html separation - always or mostly doable? by injunjoel
in thread Code and html separation - always or mostly doable? by kiat

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.