Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

TeeJay (2309)

TeeJay
  (email not shown publicly)
http://www.aarontrevena.co.uk/

Working in Truro
Graduate with BSc (Hons) in Computer Systems and Networks
pm : london.pm, bath.pm, devoncornwall.pm
lug : Devon & Cornwall LUG
CPAN : TEEJAY [cpan.org]
irc : TeeJay
skype : hashbangperl
livejournal : hashbangperl [livejournal.com]
flickr :hashbangperl [flickr.com]

Journal of TeeJay (2309)

Monday January 27, 2003
10:12 AM

HTML::Template is like TT without the good bits

[ #10213 ]
Today I am generating some static HTML pages from a data structure.

HTML::Template makes this a difficult task in many ways.

Not only do I have to jump through hoops both in the HTML and the perl to make it at all possible, I still can't do anything useful.

One thing that is really bugging me is the lack of variables inside the template - I can't create a flag inside the template and check it, this means I can't do something inside and inner loop based on the state of an external loop.

I really hope this place moves to TT soon, as H::T is just plain lame.

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • One thing that is really bugging me is the lack of variables inside the template - I can't create a flag inside the template and check it, this means I can't do something inside and inner loop based on the state of an external loop.

    It is my understanding that if you create your instance of HTML::Template with

    global_vars => 1

    then you inner <TMPL_LOOP> can see varibles outside its scope. This won't give you the fuctionality of TT but should make your life a little easier when you want to che

    --

    -biz-

  • This sounds to me like a case of using the wrong tool for the job. HTML::Template was designed to support a workflow wherein a Perl geek codes Perl and an HTML designer designs in HTML. The template syntax is kept simple so that the HTML designer doesn't have to learn a whole new language just to create a template. All the code goes in one place and all the HTML goes in another. It's nirvana when you reach it, but there's no way to get there alone.

    However, it sounds to me like you're a lone Perl geek

    • Then Template Toolkit does H::T's job better.

      A designers using TT won't need to know any more than a designer using H::T.

      But at the same time the same templates can acheive a great deal more without the ridiculous hoop jumping required with H::T.

      A designer should not have to worry about many of the problems H::T brings with it. Scoping of variables and other problems make many simple HTML layout tasks hard or impossible.

      This is why I think I that H::T is lame - it doesn't even do HTML Templating ver

      --

      @JAPH = qw(Hacker Perl Another Just);
      print reverse @JAPH;
      • Enlighten me then, where should I start in the "long list of things that H::T can't do"? I can't think of a single HTML task I haven't been able to with HTML::Template. I build web applications all day long with HTML::Template and CGI::Application, and nothing has stopped me yet!

        -sam

        • ok try looping through N lists concurrently, or looping through the keys of a hash, or using an iterator object, or keeping track of presentation logic values with variables local to the template.

          You can do anything with H::T assuming you totally mangle your data and code to squeeze everything into an array of hashes.

          --

          @JAPH = qw(Hacker Perl Another Just);
          print reverse @JAPH;