I'm (fairly) sure someone here was talking about a templating system for generating static HTML (ie you write the templates, run a script, and get a set of HTML that you upload to the website). I can't find it by searching my ALUG archive for phrases like static, HTML or template, though.
Does anyone recall what it was? If not (or regardless), does anyone have any recommendations?
I'm building a website for someone who will need to maintain the static HTML themselves when finished. Since all the pages have common elements it's a pain not templating it for my own benefit, however.
I could just work in PHP/Smarty as I normally would, then "wget --mirror" the site to generate the static HTML, but if there are better solutions I'm always happy to learn something new!
I'm (fairly) sure someone here was talking about a templating system for generating static HTML (ie you write the templates, run a script, and get a set of HTML that you upload to the website). I can't find it by searching my ALUG archive for phrases like static, HTML or template, though.
Does anyone recall what it was? If not (or regardless), does anyone have any recommendations?
Mark,
I've not had a need for this myself but last time someone at work asked about this I found some options on Google with the phrase "offline cms". Worth a try, anyway.
Peter.
On 07/04/10 11:09, samwise wrote:
I've not had a need for this myself but last time someone at work asked about this I found some options on Google with the phrase "offline cms". Worth a try, anyway.
Thanks, I'll take a look.
Although I mentioned PHP+Smarty+wget in my last email, it wasn't something I'd actually thought about until I wrote the email, so I'm just playing with that at the moment. It is a little overkill, but on the other hand it's one devil I know quite well.
On 7 Apr 2010, at 11:05, Mark Rogers wrote:
I'm (fairly) sure someone here was talking about a templating system for generating static HTML (ie you write the templates, run a script, and get a set of HTML that you upload to the website). I can't find it by searching my ALUG archive for phrases like static, HTML or template, though.
Does anyone recall what it was? If not (or regardless), does anyone have any recommendations?
I'm building a website for someone who will need to maintain the static HTML themselves when finished. Since all the pages have common elements it's a pain not templating it for my own benefit, however.
I could just work in PHP/Smarty as I normally would, then "wget --mirror" the site to generate the static HTML, but if there are better solutions I'm always happy to learn something new!
You could use some sort of markup language and have that generate the HTML for you. Perhaps something like http://sourceforge.net/projects/rest2web/ would be useful?
At Wed, 07 Apr 2010 11:05:01 +0100, Mark Rogers wrote:
I'm (fairly) sure someone here was talking about a templating system for generating static HTML (ie you write the templates, run a script, and get a set of HTML that you upload to the website). I can't find it by searching my ALUG archive for phrases like static, HTML or template, though.
Does anyone recall what it was? If not (or regardless), does anyone have any recommendations?
I'm building a website for someone who will need to maintain the static HTML themselves when finished. Since all the pages have common elements it's a pain not templating it for my own benefit, however.
I could just work in PHP/Smarty as I normally would, then "wget --mirror" the site to generate the static HTML, but if there are better solutions I'm always happy to learn something new!
It's pretty likely than *any* templating system could be used to generate output offline. (A templating engine that was irrecoverably coupled to an HTTP server would be arguably quite badly designed and should probably be treated with quite some suspicion.)
I use XSLT quite a lot which requires an XSLT processor (such as libxslt's xsltproc, sablotron, Saxon, Xalan, etc.) but is usually considered quite hard to learn.
I've also used Genshi http://genshi.edgewall.org/ which is implemented in Python and could easily be integrated into a small script.
However, Genshi (to and extent) and certainly XSLT assume that you're starting with XML encoded content.
On 07/04/10 12:53, Richard Lewis wrote:
It's pretty likely than *any* templating system could be used to generate output offline. (A templating engine that was irrecoverably coupled to an HTTP server would be arguably quite badly designed and should probably be treated with quite some suspicion.)
Actually, since Smarty is tied to PHP which is pretty much tied to HTTP server usage (I know that's not strictly true but it's fairly typical to find it installed that way), Smarty falls into the category you'd find suspicious, but it is one of the major template engines on the PHP platform. In fact I suspect that anything PHP-based will fall into this category for the same reason - PHP can be used as a general purpose scripting language but it usually is not and is much "happier" working through an HTTP server. Perl and Python are much more widespread away from HTTP server usage so it would make sense that any template systems based on them will be equally happy away from the server.
All that said, I have an HTTP server and I'm not afraid to use it! I'm building a website after all!
Mark Rogers wrote:
Actually, since Smarty is tied to PHP which is pretty much tied to HTTP server usage (I know that's not strictly true but it's fairly typical to find it installed that way), Smarty falls into the category you'd find suspicious, but it is one of the major template engines on the PHP platform. In fact I suspect that anything PHP-based will fall into this category for the same reason - PHP can be used as a general purpose scripting language but it usually is not and is much "happier" working through an HTTP server. Perl and Python are much more widespread away from HTTP server usage so it would make sense that any template systems based on them will be equally happy away from the server.
All that said, I have an HTTP server and I'm not afraid to use it! I'm building a website after all!
For what it's worth, I have (and continue to) run several high-profile (well, in our industry at least) websites using nothing more than a fairly simple Perl[1] script to parse files, scan for particular comments (acting as custom tags, like where the "content body" begins and ends or where the menu goes), read a template, generate a context-aware menu, swap a bunch of stuff around and rebuild the pages. I've never found it a problem managing sites up to a few hundred pages this way, and being my own code, it's as flexible/intelligent as I need. In fact, they're really so trivial to knock up that I've generally written a new one from scratch for each new project (as they all tend to have different rules and requirements) with only a few basics cut'n'pasted from one to the next.
If you like a spot of coding, I'd recommend something along those lines, perhaps over trying to cajole some third-party setup to do exactly what you want. And, as you say, being Perl, it's completely independent of having a local server to run against (although you'd really want this to test what you're doing!)
Simon
[1] it's not elegant, compared to Python, but Perl's string mangling^H^H^Hmatching really comes in to its own for this sort of thing.