in reply to Off-Line Content Management Scheme?

As an initial cut at the job, it's looking like HTML::Template might be a suitable thing (if I go along the "custom-build" route), as it seems fairly simple to get something working. I have a question, though.

What about if I have my HTML with, for example, a header and a left-side navigation column (placement defined via CSS) and then some "main content". This might be a "normal" page.

If I have another page that has the same layout but with differing content... and additionally, a right-side column, I could have two templates - one with header/left column and another with header/left column/right column... but most of the HTML for both templates would be the same.

How to deal with this? Should I try and maintain the two separate templates... or build a (perl) program that will conditionally add that extra right-side column... and almost defeat the purpose of the templating anyway?

  • Comment on Re: Off-Line Content Management Scheme?

Replies are listed 'Best First'.
Re^2: Off-Line Content Management Scheme?
by BrowserUk (Patriarch) on Jan 04, 2006 at 07:48 UTC
    How to deal with this? Should I try and maintain the two separate templates.

    With care in defining the templates for the header, left and right columns, it should be possible to "mix n match" those components by concatenating the templates, or concatenating the results of expanding the templates.

    Your generating script then looks something like this pseudo-code:

    if needsHeader load header template expand header template output expanded header to file endif if needsLeftColumn load LeftColumn template expand LeftColumn template output expanded LeftColumn to file endif if needsRightColumn load needsRightColumn template expand needsRightColumn template output expanded needsRightColumn to file endif ...

    This way, you specify your pages at a higher level in terms of the subcomponents that need to appear on the page, and your generation script processes that higher level description by loading and expanding the appropriate mix of templates.

    It does require care in defining the subcomponent templates, but with the use of css, and especially css2, it can make for a very concise page specifications, if the nature and layout of the data you are presenting is, or can be, standardised.


    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    Lingua non convalesco, consenesco et abolesco. -- Rule 1 has a caveat! -- Who broke the cabal?
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.