Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Templating Suggestions?

by pileofrogs (Priest)
on Jan 06, 2006 at 19:36 UTC ( #521607=perlquestion: print w/replies, xml ) Need Help??

pileofrogs has asked for the wisdom of the Perl Monks concerning the following question:

In the conversation titled "Off-Line Content Management Scheme?" I mentioned that I use M4 and make to generate static web pages. I got a reply saying that M4 and make are totally inferior to things like the Template Toolkit. I installed the Template Toolkit, and it seems a little better than my M4 & make setup, but not hugely. So, I bet I'm missing the magic of the Template Toolkit.

The thing that I always felt was missing from my M4 & make setup was the ability to build things like a table of contents and nice navigation controls at the bottom of the page. That's beyond pure M4 & make because it requires the templater to read through everything once, make lists of values, and then go through the munging.

It looks like that's also beyond what the Template Toolkit can do without some invasive help in perl code.

So, I guess my real question is, what the best way to handle static content generation if you want things like a table of contents and nice navigation controls?

My secondary question might be, is the Template Toolkit so much better than M4 and make, and if so, how?

Thanks!

-Pileofrogs

johnnywang, you rock! That article really spells out exactly what I'm looking for...

Replies are listed 'Best First'.
Re: Templating Suggestions?
by perrin (Chancellor) on Jan 06, 2006 at 20:20 UTC
    TT has tools like ttree and Template::TT2Site to help with generating a whole site. There are many discussions on how to do navigation controls in the mailing list archives and good examples in the TT book and in the tutorial docs that come with it too.

    Primary advantages over M4:

    • Much easier syntax.
    • Simple plugins for loading data from XML or databases.
    • Lots of useful formatting plugins.
    • Ability to handle nested perl data structures simply.
Re: Templating Suggestions?
by johnnywang (Priest) on Jan 06, 2006 at 21:13 UTC
    The authors of the Template Toolkit book wrote an article about how they used TT to write the TT book, in which they talked about how they kept cross references, TOC, code and code output. Here's the link: How We Wrote the Template Toolkit Book
Re: Templating Suggestions?
by esskar (Deacon) on Jan 06, 2006 at 19:43 UTC
      Are you saying that HTML::Template::Compiled is better for this than the suggestion he already has of TT? I don't see how.

      Be advised that in a related node I mentioned that Tina Mueller does not recommend H::T::C for production code.

      -- vek --
        well, in pileofrogs's case, he is using the template system offline, so there are now security issues. In online modus, there is the danger that the precompiled templates (stored in the filesystem) could be changed by a attacker, but that can happen also to people that use the precompiling stuff in TT. And yes, i prefer HTC over TT.
Re: Templating Suggestions?
by fmerges (Chaplain) on Jan 07, 2006 at 19:02 UTC

    Hi,

    I like HTML::Mason, you have the O'Reilly book online with a section in the Receipes talking about using it to create static content, see here.

    To thing about creating tables, has nothing to do with the templating system you use, it's more a thing how you want to generate them... usually you do it with loops and so, and other preffer to use things like HTML::Table or higher level modules

    Regards,

    fmerges at irc.freenode.net
Re: Templating Suggestions?
by gloryhack (Deacon) on Jan 07, 2006 at 00:26 UTC
    I like WML. And you can still use m4 and make with it!

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://521607]
Approved by Corion
Front-paged by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (7)
As of 2020-01-20 15:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?