Re: templating system opinions - Mason recommendation

2003-07-19 Thread Randal L. Schwartz
 Stas == Stas Bekman [EMAIL PROTECTED] writes:

Stas While Andy is working on it, you can read a TT for mod_perl chapter in
Stas Practical mod_perl, written by Andy as well! (http://modperlbook.org)

Man, that guy is *everywhere*!

:-)

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
[EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!


Re: templating system opinions - Mason recommendation

2003-07-18 Thread Chris Devers
Sorry to cc: this to the list, but I stand corrected and might as well
mention that to the list :)


On Fri, 18 Jul 2003, Dave Baker wrote:

 Correction: Bricolage is written in Mason, I believe. That's what the
 Bricolage authors say at http://bricolage.cc/

Hmm, so it does. I wonder where I got the idea that it was H::T based...

 I'm very pleased with Mason -- the online O'Reilly book about Mason is
 at http://www.masonbook.com/book/

A little bird tells me that TT is about to get an O'Reilly book as well,
though it's not on their upcoming titles page (yet).

The only H::T dead-trees material that I know of is a section in _CGI
Programming with Perl_, 2nd edition -- that's where I learned it. I like
the simplicity of H::T, but most other people seem to prefer TT or Mason.
I still think it comes down to whichever system meets your needs the best,
and in different contexts any of them (or others) could be appropriate.


This may have been covered before here, but Zope supports an interesting
template mechanism called TAL, where everything is done by attributes for
the HTML tags, rather than special logical tags as most other systems use
(e.g. the ones mentioned above, SSI, PHP, ASP, JSP, etc). This has the
nice side effect of guaranteeing that all your html templates are always
valid, and so can be used in any html IDE without complication. So for
example, picking a random sample from the spec:


Repeat

  Syntax:
   argument  ::= variable_name expression
   variable_name ::= Name

  When you want to replicate a subtree of your document once for each
  item in a sequence, you use repeat.  The expression should evaluate
  to a sequence. If the sequence is empty, then the statement element
  is deleted, otherwise it is repeated for each value in the sequence.
  If the action is cancelled, then the element is left unchanged, and
  no new variables are defined.

  The variable_name is used to define a local variable and a repeat
  variable. For each repetition, the local variable is set to the
  current sequence element, and the repeat variable is set to an
  iteration object.  You use iteration objects to access information
  about the current repetition (such as the repeat index).
  (Iteration objects are more properly the domain of TALES.)  The
  repeat variable has the same name as the local variable, but is
  only accessible through the builtin variable named repeat (see
  RepeatVariable).

  Examples:

p tal:repeat=txt python:'one', 'two', 'three'
   span tal:replace=txt /
/p
table
  tr tal:repeat=item here/cart
  td tal:content=repeat/item/index1/td
  td tal:content=item/descriptionWidget/td
  td tal:content=item/price$1.50/td
  /tr
/table


It's a pretty clever approach; I'd like to see something like this done
with a Perl backend (I haven't really been keeping track of development,
for all I know there already is a Perl backend...). Read more:

  http://www.zope.org/Wikis/DevSite/Projects/ZPT/TAL
  http://www.zope.org/Wikis/DevSite/Projects/ZPT/TAL%20Specification%201.4


But anyway, Zope isn't mod_perl, so that's probably not what the original
person was hoping to read about... :)



-- 
Chris Devers[EMAIL PROTECTED]


Re: templating system opinions - Mason recommendation

2003-07-18 Thread Leon Brocard
Chris Devers sent the following bits through the ether:

 It's a pretty clever approach; I'd like to see something like this done
 with a Perl backend (I haven't really been keeping track of development,
 for all I know there already is a Perl backend...). Read more:

Your wish is my command. Witness the amazing appearance of Petal -
Perl Template Attribute Language - TAL for Perl! on the rather
tastefully-coloured:
http://search.cpan.org/author/JHIVER/Petal-1.00/lib/Petal.pm

Leon
-- 
Leon Brocard.http://www.astray.com/
scribot.http://www.scribot.com/

... Have you seen Quasimoto? I have a hunch he's back!