Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
Most template solutions have minimal built in logic to differ output based on program input. (or least I know that Template Toolkit does for sure). However, I only do this when the change is subtle with the overall page keeping much of the same layout; insted it's usually easier to write two different template files if the change is more drastic. Note that still cleans up your perl code, more so than writing two branches of CGI.pm HTML functions.

But templates are not always the solution in every case. If you have a SSI included script, for example, you only need the minimal HTML that CGI provides. Short, demonstration scripts that aren't really part of a site could easily qualify as well. In addition, if you are building a page that has to be speedy (maybe it's your home page of a million+ hits per day site), a template solution could just slow you down, though if the rest of the site is in template form, it's a tossup. (In general in this situation, your 'entrance' page ought to be statically delievered, which might mean you need to create it every 5 minutes or so from dynamic content).

But if you are building a site of any magnitue more than a handful of pages, you really ought to be considering templates as to avoid problems with consistent site look after a time.


Dr. Michael K. Neylon - mneylon-pm@masemware.com || "You've left the lens cap of your mind on again, Pinky" - The Brain

In reply to Re: Re: Re: Separation of content and code by Masem
in thread Separation of content and code by Draff

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



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (5)
As of 2024-04-24 20:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found