Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: ModPerl: ModPerl

choose a template

 

 

ModPerl modperl RSS feed   Index | Next | Previous | View Threaded


practicalperl at gmail

Jun 17, 2009, 7:36 PM

Post #1 of 5 (386 views)
Permalink
choose a template

Hello,

We have a new project, which is medium large, with about 300 CGI
scripts with Perl.
We have designers who make HTML/JS/CSS etc. But designers don't know Perl.
I want to choose a template system which will separate Perl code from
front-page codes (like html,css etc).
I have the experience on using HTML::Template and Template::Toolkit.
HTML::Template is too simple, for example, if the programmer want to
generate a dynamic "select" form, the template can't handle it.
Template::Toolkit is smart enough, but it requires designners to know
some syntax about Perl.

So, is there any other good choice? Any suggestion are welcome. Thanks.

Jenn


pharkins at gmail

Jun 17, 2009, 7:39 PM

Post #2 of 5 (366 views)
Permalink
Re: choose a template [In reply to]

On Wed, Jun 17, 2009 at 10:36 PM, <practicalperl[at]gmail.com> wrote:
> Template::Toolkit is smart enough, but it requires designners to know
> some syntax about Perl.

How so? I've often used TT with people who didn't know any perl. How
is it more difficult for them than HTML::Template is?

- Perrin


practicalperl at gmail

Jun 17, 2009, 8:37 PM

Post #3 of 5 (362 views)
Permalink
Re: choose a template [In reply to]

I got the code piece from Template's manual:

my $vars = {
root => 'http://here.com/there',
menu => [ 'modules', 'authors', 'scripts' ],
client => {
name => 'Doctor Joseph von Satriani',
id => 'JVSAT',
},
checkout => sub { my $total = shift; ...; return $something },
shopcart => My::Cool::Shopping::Cart->new(),
};


[% IF shopcart.nitems %]
Your shopping cart contains the following items:
<ul>
[% FOREACH item = shopcart.contents %]
<li>[% item.name %] : [% item.qty %] @ [% item.price %]
[% END %]
</ul>

[% checkout(shopcart.total) %]

[% ELSE %]
No items currently in shopping cart.
[% END %]



Here, aren't shopcart.nitems and shopcart.contents method calling of
an object like?
So I was thinking designers will be confused on them.

Thanks.
Jenn.

On Thu, Jun 18, 2009 at 10:39 AM, Perrin Harkins<pharkins[at]gmail.com> wrote:
> On Wed, Jun 17, 2009 at 10:36 PM, <practicalperl[at]gmail.com> wrote:
>> Template::Toolkit is smart enough, but it requires designners to know
>> some syntax about Perl.
>
> How so?  I've often used TT with people who didn't know any perl.  How
> is it more difficult for them than HTML::Template is?
>
> - Perrin
>


pharkins at gmail

Jun 17, 2009, 8:50 PM

Post #4 of 5 (363 views)
Permalink
Re: choose a template [In reply to]

On Wed, Jun 17, 2009 at 11:37 PM, <practicalperl[at]gmail.com> wrote:
> Here, aren't shopcart.nitems and shopcart.contents method calling of
> an object like?

Yes. If you don't like passing objects, you could just pass the list
of items as an array of hashes. One nice thing about TT here is that
the syntax is the same.

> So I was thinking designers will be confused on them.

Whether you pass data or objects, you'll have to tell your designers
what they have to work with. This usually means writing some simple
documentation telling them what's available on the page.

I used to never pass objects, thinking it would lead to poor coding
practices in the templates. Sometimes it does, but it's very
convenient. My experience has been that anyone who can write HTML has
no trouble with the concept of a shopping cart object that has a list
of properties they can access.

- Perrin


rjk-perl-modperl at tamias

Jun 18, 2009, 11:51 AM

Post #5 of 5 (359 views)
Permalink
Re: choose a template [In reply to]

On Thu, Jun 18, 2009 at 11:37:06AM +0800, practicalperl[at]gmail.com wrote:
> Here, aren't shopcart.nitems and shopcart.contents method calling of
> an object like?
> So I was thinking designers will be confused on them.

JavaScript has objects, and also uses dot syntax for accessing object
properties.

Ronald

ModPerl modperl RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact lists@gossamer-threads.com
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.