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

Apologies if this is totally off-topic or in the wrong place... but having looked at the "Where should I post X" node, I thought this would still be the best place to ask.

I'm currently looking to build some new web sites and I'm looking for some ideas in terms of how I might build and maintain the sites.

Up to date, I'd been using a custom-made system where I have some text files that are processed by a C program to make them into a fixed style of HTML. It was good because it made maintenance easy - I could just change the text file, run my program on the text file and the new HTML was generated and installed, no problems. The disadvantages were that I could not automatically change the underlying HTML (format) or the "look" of the program without rebuilding the C program. There was also no CSS code used which meant the sites were fairly "fixed" in their behaviours.

So now I'm looking for a new system. The biggest thing to decide is whether to go the custom-made route again (using HTML::Template for example) or to try something "off the shelf".

The requirements I have are basically these:

I've checked out a few of the perl script archives (hotscripts, codeproject, devshed, etc) but none of the content management scripts there seem suitable. I've similarly gone through Google, Kartoo, etc and haven't found anything much like what I want either.

So, if you have any suggestions on script archives to check or freeware/open source software I might try, I'd be pleased to hear about them... and very grateful.

Thanks for your help, folks.

 

John

Replies are listed 'Best First'.
Re: Off-Line Content Management Scheme?
by Corion (Patriarch) on Jan 03, 2006 at 09:12 UTC

    As you don't seem to need much of the features a Content Management System provides (versioning, publishing, collaboration, ...), I think that Template Toolkit with its ttree tool will be enough for you - it takes a whole tree of Template::Toolkit files, processes them, and spits out the results into new files.

    The problem you have is now that you need to learn the Template Toolkit syntax and how to structure your templates. There is ample documentation in the Template Toolkit book, but for the simpler things, the documentation of Template Toolkit itself is sufficient.

    Of course, this leaves you with the problem of pushing that data on to a webserver, but that is easily done by using rsync or simply scp, depending on the volume of data to be transferred.

Re: Off-Line Content Management Scheme?
by ozboomer (Friar) on Jan 03, 2006 at 10:41 UTC
    Thanks to the suggestion about Template Toolkit, I had some more terms to search...

    I've yet to fully investigate "TT" but I've already found an interesting article:

    It compares the various templating options available, which is handy as I'm not sure how fancy I need to be with my web sites and their structures.

    Many thanks for the helpful pointer.

     

    John

Re: Off-Line Content Management Scheme?
by samizdat (Vicar) on Jan 03, 2006 at 15:07 UTC
    I used to do exactly what you describe, building static pages from text files (and also catalog databases) where I didn't need to worry about rapidly changing content. There are many applications where this is the case, and in today's world of large caches and huge disks (200 GigaBytes??? My first computer {see homenode} had 2048 by 16 bits total read-write memory!!!), static pages are a viable option.

    I would look at HTML::Template and HTML::Embperl, but I'd also consider spending some cycles learning the Cascading Style Sheets (CSS) style definition language, or, at least, enough to become dangerous. Google for CSS tutorials, you'll find lots, and O'Reilly's CSS book is (while somewhat obsolete) good to have handy. You'll find that your HTML can become really plain and as easy to generate from Perl as you did from C.

    One thing that templating systems like TT and EP give you that's really handy is the ability to build tables on the fly from arrays. In EP, defining one table row with the $row and $col special variables gives me an entire table from whatever source I choose, be it a tab-text table sucked in and split(/\t/), or a MySQL query result array. I've got a complete application that displays and graphs data from hundreds of different tests on three different chip families that is composed of three HTML/Embperl files, a MySQL database, and a few supporting insert files. Yes, this is dynamic HTML rather than static, but you can choose how much is dynamic and how much is static when you have a templating tool that handles both options.

    Don Wilde
    "There's more than one level to any answer."
Re: Off-Line Content Management Scheme?
by pajout (Curate) on Jan 03, 2006 at 11:30 UTC
    It looks like a interest quest, :), though I do not know Template::Toolkit, I see following solution:
    1/ Xmlize your input data. You can rewrite your C code to output XML rather then HTML.
    2/ Prepare XML metadata files, which defines, which parts of your data have to be dressed on which clothes (clothes are other XML metadata)
    3/ Prepare relatively generic XSLT stylesheet, which supports that processing (both XML data and metadata as input, HTML as output)
    4/ Write the perl script to do these transformations

    I think that sometimes it is better to write more code than learn some powerfull but huge tools...
      Some interesting thoughts there, thanks... but beyond my present scope a mite :)

      I've been using Perl for 10+ years now but have yet to learn XML or go beyond HTML (other than some basic CGI). I only learnt a bit about CSS in the last year or two... hence the desire to fix my web sites(!)

      I haven't been working in SysAdmin for some years now so I don't need to "push" Perl as hard as I might have... but I still find Perl can do everything I need in both basic SysAdmin (my home computers) and applications (what with Perl/Tk, etc)... This is why I'm trying to come up with a simple solution, using (mostly) things I know.

        You are right, this is needless effort to study xslt transformations for you. It is powerfull tool supporting combining content and face, but it is long journey to make good knowledge about its advantages and/or disadvantages.
Re: Off-Line Content Management Scheme?
by adrianh (Chancellor) on Jan 03, 2006 at 13:11 UTC
    So, if you have any suggestions on script archives to check or freeware/open source software I might try, I'd be pleased to hear about them... and very grateful.

    You might want to look at Bricolage and Krang.

Re: Off-Line Content Management Scheme?
by Thilosophy (Curate) on Jan 04, 2006 at 07:36 UTC
Re: Off-Line Content Management Scheme?
by pileofrogs (Priest) on Jan 03, 2006 at 21:41 UTC

    I use M4 and make.

    M4 is a venerable, standard macro language and make is great for keeping everything in sync. It's also really easy to learn.

    define(`_foo',`<H1>$1</H1>')dnl _foo(`That was easy')dnl

    Now you know how to use M4.

    Okay, maybe it's not that simple...

    Here's the link to the manual for Gnu's M4. http://www.gnu.org/software/m4/manual/html_node/index.html

    It's great for writing re-usable chunks (_my_header(), _my_footer(), etc..). Not so great for complex formatting (e.g., automatically generating a table of contents from all your different sections)

    -Pileofrogs

      I don't want to put down a solution that is working well for you but M4 is a terrible choise for website management when there are so many highly capable tool kits that are dedicated to the task. As far as I know, there are no robost toolkits for generating a complete site of HTML page with M4. There's nothing wrong with rolling your own but that's hardly a productive use of one's time these days...

      For a beginner I would recommend something like the Template Toolkit which is well documentend and has a large enough community around it to help beginners.

      Cheers,

      -J

Re: Off-Line Content Management Scheme?
by gloryhack (Deacon) on Jan 03, 2006 at 20:30 UTC
    You might give a look at WML, Engelschall's "Website Meta Language". I maintain some smallish sites with it and it's saved me a lot of time.
Re: Off-Line Content Management Scheme?
by ozboomer (Friar) on Jan 04, 2006 at 07:22 UTC
    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?

      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.
Re: Off-Line Content Management Scheme?
by saberworks (Curate) on Jan 03, 2006 at 15:48 UTC
    Sounds like you want CityDesk by Fog Creek Software (http://www.fogcreek.com/)
Re: Off-Line Content Management Scheme?
by ozboomer (Friar) on Jan 05, 2006 at 11:11 UTC
    Well, I've had another look at everyone's suggestions... and I think I'll have a go with using HTML::Template. For my situation, the other suggestions are probably over-complicated for the simple operations I will need to do.

    I've installed HTML::Template and with the Monks tutorials, as well as the standard docs, I'm fairly sure I'll be able to create something fairly easy to use and maintain... and I'll understand it pretty well.

    The only problem now is how to define the "structure/configuration" of the web sites... and for me, I'll probably store the info in plain text files. I'll probably manually build the files (rather than fiddling about with hashes or b-trees to maintain all the navigation paths) and use Config::Simple or maybe CSV files for the actual storage. I know - XML is de rigueur - but I've used CSV files a lot and I already have lots of code to manipulate CSV files.

    Again, many thanks for everyone's help.