Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

Fellow monks:

I've got to make two small websites, six to ten pages each. Neither of these webservers support any sort of server-side insertion or scripting. I've got a number of common elements (page header, navigation bar, and so on) which need to be identical across all these pages.

I've been looking for a module which will allow me to "assemble" these pages from source files. I only need two bits of functionality: my individual page files should be able to specify templates to be inserted at the appropriate places, and in specifying these templates, I should be able to pass values to them.

(Since I ended up following the suggestions in the comments, the following description of how I planned to do it is irrelevant. I've wrapped it in <readmore>s that it may trouble us mortals no more).

For example, index.txt might contain:

[:top |title=Welcome to | is blah blah blah :] <p>Welcome to [..]</p>

And top.txt will contain:

[:preamble:] <head> <title>[:$title:]</title> </head> <body>

To my surprise, I can't find a simple module which accomplishes this: there's plenty of template engines, but they're designed for on-the-fly generation of page layouts for dynamic websites, and are largely overkill for my task. I strongly suspect that I can't come up with the right search terms, and that such a module must exist on CPAN somewhere.

Does anybody have any ideas on how to find this module, or am I just going about this task all wrong? I've already started rolling-my-own, with the template format mentioned above, so a module to do this will definitely exist on CPAN in a week or two :-). But I'd hate to end up rewriting somebody else's wheel.

Update Oct 24, 2008: Thanks, everybody! Consensus is, don't roll your own; spending the time figuring out one of the fully-featured template engines will be worth it in the end. The Big Player in this area is the venerable Template::Toolkit, which Your Mother strongly recommended. HTML::Template was pointed to as a simpler, less complicated system, but Your Mother's point - that having learnt Template::Toolkit, you won't need anything else - is a good one.

Update Oct 27, 2008: I tried out WebMake today, and it was exactly what I wanted! Thanks, TGI! I used it to write a new website for; I've also uploaded the source for the entire website. If you're tackling a similar problem to what I describe above, you'll get an idea of what a WebMake file looks like, and what it can do. Available now at the website mentioned above, or (one version ago) at any reputable CPAN mirror. I'm going to try doing another website with Template::Toolkit, and I'll "report back" once that's done.

Once again, thanks to everyone for their help and advice!

In reply to Assembling text into websites by ggvaidya

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?

    What's my password?
    Create A New User
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others about the Monastery: (6)
    As of 2020-03-30 17:27 GMT
    Find Nodes?
      Voting Booth?
      To "Disagree to disagree" means to:

      Results (175 votes). Check out past polls.