Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: Re: Web Application Frameworks and their Templating Engines with a Comparative Study of Template and HTML::Template

by princepawn (Parson)
on Apr 27, 2001 at 03:04 UTC ( [id://75958]=note: print w/replies, xml ) Need Help??


in reply to Re: Web Application Frameworks and their Templating Engines with a Comparative Study of Template and HTML::Template
in thread Web Application Frameworks and their Templating Engines with a Comparative Study of Template and HTML::Template

One of the addition benefits of Template (beyond what merlyn said),
There is nothing that merlyn listed in his post that shows an advantage of Template over HTML::Template. He did place it on equal ground but did not state any features it held that HTML::Template did not.
is that Template is language neutral, and as WAP-enabled sites become more common, using Template over HTML::Template may become beneficial, since all you need to do for delieving WAP vs HTML is change the template file; you should not have to touch any perl code save to point the Template processor to the right place. And then adding text-only becomes simplier as well.
Your point about easily changing the display method from HTML to something else is well-taken as an advantage of Template It was a key point in davorg's article which I found on his website and which seems to have vaporized from perl.com However, consider this part of your statement:
you should not have to touch any perl code save to point the Template processor to the right place.

But the obvious question is: you will have to change the display code, right? How would one change all the HTML tags to the formatting conventions of another format? Ie, plain text, XML, HTML, or WAP? One way would be to code in "Template HTML" so that you could transform all the tags at once, ie:

[% H1 %] This is a header [% OL %] [% LI %] we can make an HTML file if we want, [% LI %] but we could make some thing else [% LI %] just as easy. [% OL %]

This is just brainstorming. I don't have a full answer.

Replies are listed 'Best First'.
Re: Re: Re: Web Application Frameworks and their Templating Engines with a Comparative Study of Template and HTML::Template
by davorg (Chancellor) on May 02, 2001 at 14:01 UTC
    davorg's article which I found on his website and which seems to have vaporized from perl.com.

    It is still on perl.com, it's just a little tricky to find. It's here.

    Another advantage of TT2 that you seem to have missed, is that TT2 isn't tied to web applications. It can be just as easily used in any kind of data processing system. I know people, for example, who use it to generate DNS zone files. How easy is that with HTML::Template?

    --
    <http://www.dave.org.uk>

    "Perl makes the fun jobs fun
    and the boring jobs bearable" - me

      Quite easy in fact.

      Just don't use HTML tags. All HTML::Template does is generate a string by doing replacement of <tmpl_var name='foo'> with the value of parameter foo, and a little intelligent looping and if/else/unless-ing. There's no reason you HAVE to use it only for generating HTML from processed CGI requests.
      --
      Jason Klueber
      ookami@insightbb.com

      /(bb)|^b{2}/
      --Shakespeare
Re: Re: Re: Web Application Frameworks and their Templating Engines with a Comparative Study of Template and HTML::Template
by Masem (Monsignor) on Apr 27, 2001 at 04:48 UTC
    Well, that's the important part with regards to having one perl script put out output for numerous output formats. If the "output generation" is sufficient separated from the perl code, the perl code and logic is much clean, and all that is left to do is to write, for each output type you want to support, a template to fill in the blanks. If you set up the arguments that you pass to Template correctly, for example, you don't need to change the data that you pass to the Template processor, and in the various files, you write what you want to include. For example, if I was writing a on line bookstore, the HTML front end might have not only the ISBN, price, publisher, etc, but the short synapsis, reviews, etc etc. on every page. On the other hand, I might only want the ISBN, and short details for a WAP output. But I only need to write one database call to do both.


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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://75958]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (3)
As of 2024-03-29 05:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found