Hey Everyone,

    Just wanted to let Brett and Simon know that both of their little
tutorials for me worked GREAT!!! Both methods are perfect for me; I actually
understand them. Just ordered a copy of Elements of Programming with Perl,
found a perl mongers group in my city(although, I think it might be dead),
and looked through perlmonks.org w/ a bookmark! Thanks for the excellent
help!

-Wassim

----- Original Message -----
From: "Simon Wilcox" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Wednesday, April 24, 2002 5:15 PM
Subject: Re: [Templates] Newbie Needs Help :-)


> On Wed, 24 Apr 2002 [EMAIL PROTECTED] wrote:
>
> >     I'm a newbie and need some help :-).
>
> Welcome :-)
>
> > It goes HEADING|DATE|NEWS, so, I want to use Template Toolkit to pass
> > this data to my template file. Here is what I have so far, but, I
> > can't figure out how to separate the data by the |'s and update my
> > news.
>
> The Datafile plugin could help you here. You need to add a header line to
> your datafile with the field names in it, delimited the same way as the
> data. In this case perhaps:
>
> heading|date|news
> Fill Me|4.19.2002|News filler cause what else do you write at 4AM? Only
filler.... only filler.
> Hurt|4.20.2002|I hit myself on the head today; still alive, will try
again, tomorrow.
>
>
> Then in your template you do:
>
>      [% USE mydata = datafile('/path/to/datafile', delim = '|') %]
>
>      [% FOREACH record = mydata %]
>         [% record.heading %]  [% record.date %]
>         [% record.news %]
>      [% END %]
>
> Eventually, you will want to prepare your data in perl before you call
> your template as this gives you greater flexibility, but this plugin
> allows you to get started straight away.
>
> More details in the man page : perldoc Template::Manual::Datafile
>
> >                                   Also, Perl is the first language
> > Ive ever tried to learn after HTML,
>
> A fine choice and with TT you will have a very powerful way of creating
> dynamic applications for the web.
>
> >                                    I would enjoy book suggestions:
>
> Learning Perl is certainly excellent and I've heard good things about
> Elements of Programming with Perl [1] from Manning too. Before you get too
> far you'll probably want to get the Camel book (Programming Perl) which is
> more of a reference manual but I've found it quite invaluable.
>
> You should also check out www.pm.org and find a perlmongers group near
> you, they will be able to help with any problems you might have with perl
> in general (as well as being quite sociable :).
>
> HTH,
>
> Simon.
> [1] http://www.manning.com/Johnson/index.html
>
> --
> "Twang him into a tree!"
>
>
>
>







Reply via email to