Here's how I would go about it...

1. Load the data into Perl as a data structure from a data file, database,
or wherever (I'd probably use a database for something that big).

2. Have one template file that has fields for each of the parameters that
varies for each person

3. Have your Perl script execute the process() method for the template file
once for each person, generating a new file each time.

On Sat, May 16, 2009 at 5:39 PM, Ralph <ra...@download-jigsaw-puzzles.com>wrote:

> I'm trying to figure out if TT can be used to solve a problem that I
> have:  I need to generate several thousand static web pages, following a
> template.  I've read the tutorials and other documentation, but the
> examples all seem to include the variable values in the template itself,
> which (I suppose) makes for a clearer example, but would be pointless in
> real life.
>
> Here's a simplified example of what I want to do:
>
> 1.  Create a data file with a list of names (e.g., "Manny", "Moe", and
> "Jack").
> 2.  Create a template that would simply display the sentence "This is [%
> name %]'s page", where [% name %] is a variable, to be read from the table.
> 3.  Generate a different page for each name, and save the page as
> manny.html, moe.html, jack.html.
>
> So I would wind up with three html pages, one that says "This is Manny's
> page." (saved as manny.html), one that says "This is Moe's page." (saved
> as moe.html), and one that says "This is Jack's page." (saved as
> jack.html).
>
> The tutorial examples seem to assume a one-to-one correspondence between
> template pages and output pages.  What I'm after is being able to use a
> single template page, and a data file, to generate a separate html page
> for each name in the data file.
>
> Can someone tell me if TT will do this, and if so, how?  Or, if it's
> covered in the Badger book, tell me that (if you know for sure) and I'll
> buy the book.
>
> Thanks in advance for anyone who can help.
>
> Ralph
> --
> Free downloadable jigsaw puzzles!
> http://www.train-puzzles.com/
> http://www.free-jigsaw-puzzle-downloads.com/
> http://www.airplane-jigsaw-puzzles.com/
> http://download-jigsaw-puzzles.com/
>
> _______________________________________________
> templates mailing list
> templates@template-toolkit.org
> http://mail.template-toolkit.org/mailman/listinfo/templates
>



-- 
Check out my LEGO blog at http://www.brickpile.com/
View my photos at http://flickr.com/photos/billward/
Follow me at http://twitter.com/williamward
_______________________________________________
templates mailing list
templates@template-toolkit.org
http://mail.template-toolkit.org/mailman/listinfo/templates

Reply via email to