RE: [Templates] Using TT to create word docs.
You may also wish to inquire if PDF might be suitable, as there are several approaches for generating them fairly easily. Bryce On Thu, 29 Jan 2004, Peter Guzis wrote: I am not aware of any platform-neutral method for writing a Word document, but you could create the next best thing, a Rich Text Format file using one of the following methods. * Create an RTF file directly with something like RTF::Writer or * Generate HTML with Template Toolkit and feed the output to HTML::FormatRTF Peter Guzis Web Administrator, Sr. ENCAD, Inc. - A Kodak Company email: [EMAIL PROTECTED] www.encad.com -Original Message- From: Randall Marbach [mailto:[EMAIL PROTECTED] Sent: Thursday, January 29, 2004 1:26 PM To: TT Subject: [Templates] Using TT to create word docs. Hi All I have a new job that requires me to to take data out of a database, process it and then put the results on the web and also into a Microsoft word document. I am using perl and Class::DBI for the database side and a plan to use TT for the reporting side that I will be using to generate the HTML for the web. I would also like to use the TT to somehow produce the required word document. What would be the best approach to this problem? I am new to TT and I just started reading the Badger Book, so any advice would be deeply appreciated. TIA Randy __ Do you Yahoo!? Yahoo! SiteBuilder - Free web site building tool. Try it! http://webhosting.yahoo.com/ps/sb/ ___ templates mailing list [EMAIL PROTECTED] http://lists.template-toolkit.org/mailman/listinfo/templates ___ templates mailing list [EMAIL PROTECTED] http://lists.template-toolkit.org/mailman/listinfo/templates ___ templates mailing list [EMAIL PROTECTED] http://lists.template-toolkit.org/mailman/listinfo/templates
Re: [Templates] TT Advocacy
On Tue, 27 Jan 2004, Simon Wilcox wrote: On Tue, 27 Jan 2004, Dave Cross wrote: And, if so, shall I start to collate information? peace direct - http://www.peacedirect.org/ Digital Craftsmen - http://www.digitalcraftsmen.net/ Dynamo Youth Theatre - http://www.dyt.org.uk/ All static sites built using TT and ttree. The website is statically build using TT and ttree. We also use TT for some of our web/db tools. OSDL Website - www.osdl.org Document management system app - http://docsys.sourceforge.net Racked hardware viewer app - http://rackview.sourceforge.net TT-based web/db middleware - http://eidetic.sourceforge.net Bryce [EMAIL PROTECTED] ___ templates mailing list [EMAIL PROTECTED] http://lists.template-toolkit.org/mailman/listinfo/templates
Re: [Templates] CGI/TT vs SSI
On 10 Oct 2003, David Dyer-Bennet wrote: Tosh Cooey [EMAIL PROTECTED] writes: After reading some of the things that Randall has suggested I was thinking about making the menu static, but then I have to rebuild after every change, and also lose a bit of dynamism. I'm running a mod_perl environment. Is this just a case of; six of one, one-half dozen of the other or is forcing a Template-process call on hapless static HTML, just to put in a menu, a bit of overkill? To a first approximation, CPU spent at build time is free. You build so few times, compared to the number of times the page is viewed. So unless you *need* minute-by-minute dynamic generation of your site, you win by using a build-time process to produce pages which are then served statically. I've used this on the last couple of sites I've designed, and am liking it *very* much. In both of them I do have a couple of live CGIs for things that really *do* change minute by minute. I also have an automated every-day rebuild, so that scheduled events can be listed only for the current and future days, not letting the past events linger around. I'd ditto these remarks. The OSDL website is not huge - takes less than a minute to rebuild - but we occasionally get high traffic spikes (such as when we hired Linus). The troubles we've had with using a build system are more process related than efficiency related, but they've been workable. By the way, we've been experimenting with various versions of the Linux kernel for the web server, as we're wont to do, and found some pretty major performance benefits from upgrading from 2.4 to 2.6. For example, we'd typically seen load spikes in the 5-10 range on the webserver under 2.4 kernels, but with 2.6 we rarely see above 1, even including during the traffic spikes mentioned above. Obviously this is very anecdotal, but it suggests that if you're strongly interested in maximizing performance you may get more bang-for-the-buck to focus on getting a good kernel. (Btw, we've also encountered a few stability issues with the kernel on our webserver, so if you're in a high availability situation you may want to hold off a bit for 2.6 to mature.) Bryce ___ templates mailing list [EMAIL PROTECTED] http://lists.template-toolkit.org/mailman/listinfo/templates
[Templates] Announce: Cvs-Brancher 1.00
Static websites have a number of advantages over dynamically built sites, but one of the disadvantages is being able to schedule deployment of new content at arbitrary times. Cvs-Brancher is designed to address this issue by making it straightforward to branch a CVS tree and schedule a merge and rebuild using 'at'. http://freshmeat.net/projects/cvsbrancher/ An example for use of this is for posting press releases and other assorted website changes at 5am west coast time, to co-incide with start of business east coast time. This was the primary motivation for writing it. The advantage of doing a branch/merge is that regular maintenance can go on while the scheduled release is assembled and tested. Cvs-Brancher provides options to control what actions it should take in case of merge errors. While intended for CVS-based websites that use a build tool such as ttree, it is implemented generically and may have non-web uses, such as deploying cfengine-based system config changes, etc. Bryce ___ templates mailing list [EMAIL PROTECTED] http://lists.template-toolkit.org/mailman/listinfo/templates
Re: [Templates] ttree enhancement request
On 6 Oct 2003, David Dyer-Bennet wrote: Andy Wardley [EMAIL PROTECTED] writes: David Dyer-Bennet wrote: Forgive me for not knowing the power structure around here I am the power structure! Bwah-hah-hah-hh! As a friend told me some years ago when I was chairing a large science fiction convention, Power corrupts. Absolute power is kinda neat. is that patch or something like it likely to get into the development tree, Yes. Thanks. Ditto! Btw, I've done some work on ttree to create more metadata about the tree and the file being processed, for building breadcrumbs and automatic navigation. You can see the results at http://www.osdl.org. My changes are kinda hackish (and not documented as they should) but I'll post them if there's interest. Bryce ___ templates mailing list [EMAIL PROTECTED] http://lists.template-toolkit.org/mailman/listinfo/templates
Re: [Templates] ttree enhancement request
On 3 Oct 2003, David Dyer-Bennet wrote: Bryce Harrington [EMAIL PROTECTED] writes: On 3 Oct 2003, David Dyer-Bennet wrote: There doesn't seem to be any way to set the ABSOLUTE or RELATIVE attributes when processing through ttree. It's good to have control over what kind of pathnames are allowed -- but the dangerous situation is when running via CGI or mod_perl, with untrusted user inputs; when running via ttree, it's a much more controlled environment, and I'd like to turn on more flexible path rules, but there isn't any way to. Maybe this'd do it for you... [patch snipped] That looks about right; although I believe it's not absolute *vs.* relative; it's turning on either or both of absolute and relative independently, and the alternative is paths descending only from things in the library directory list. I don't actually like having too many things in that list, since name duplications could be, um, too exciting. Hmm, ok well the enclosed patch makes both configurable. Forgive me for not knowing the power structure around here -- is that patch or something like it likely to get into the development tree, or will any patch I apply for this be my own problem for all future versions? No clue, I'm just a user like you. Bryce --- /usr/bin/ttree 2003-07-22 18:08:55.0 -0700 +++ ttree 2003-10-03 16:19:47.0 -0700 @@ -71,6 +71,8 @@ my $ignore = $config-ignore; my $copy = $config-copy; my $accept = $config-accept; +my $absolute = $config-absolute; +my $relative = $config-relative; my $srcdir = $config-src || die Source directory not set (-s)\n; my $destdir = $config-dest @@ -107,7 +109,8 @@ # now create complete parameter hash for creating template processor my $ttopts = { %$ucttopts, -RELATIVE = 1, +RELATIVE = $relative, +ABSOLUTE = $absolute, #INCLUDE_PATH = [ @$libdir, '.' ], INCLUDE_PATH = [ $srcdir, @$libdir ], OUTPUT_PATH = $destdir, @@ -336,6 +339,8 @@ 'preserve|p' = { DEFAULT = 0 }, 'all|a' = { DEFAULT = 0 }, 'debug|dbg' = { DEFAULT = 0 }, +'absolute'= { DEFAULT = 0 }, +'relative'= { DEFAULT = 0 }, 'define=s%', 'ignore=s@', 'copy=s@', @@ -419,6 +424,11 @@ # recurse into any sub-directories and process files (-r) recurse +# Turn on absolute paths +#absolute + +# Turn on relative paths +relative # # The 'cfg' option defines a directory in which other ttree configuration @@ -622,6 +632,8 @@ For example: interpolate + absolute + relative post_chomp pre_process = header post_process = footer @@ -653,4 +665,4 @@ =head1 SEE ALSO -Ltpage|Template::Tools::tpage \ No newline at end of file +Ltpage|Template::Tools::tpage ___ templates mailing list [EMAIL PROTECTED] http://lists.template-toolkit.org/mailman/listinfo/templates
Re: [Templates] Simple parse error
On Wed, 6 Aug 2003, Edward Tsai wrote: Hello everyone, I'm getting the following error from the following file Template process failed: Template::Constants::ERROR_FILE error - parse error - request.html.tmpl line 10: unexpected end of input from [% INCLUDE header title = 'TEmplate Toolikt' %] ul [% FOREACH person = login_name %] li loginname is [% person %] [% END %] /ul [% INCLUDE footer %] which is called from another file referencing my $template = Template-new({ INCLUDE_PATH = '/home/etsai/scrs/templates/src:/home/etsai/scrs/templates/lib', PRE_PROCESS = 'config', }); $template-process('request.html.tmpl', $vars) || die Template process failed: ,$template-error(), \n; } and the standard header footer files are under /home/etsai/scrs/templates/lib Thank you, -Edward __ Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.yahoo.com ___ templates mailing list [EMAIL PROTECTED] http://lists.template-toolkit.org/mailman/listinfo/templates ___ templates mailing list [EMAIL PROTECTED] http://lists.template-toolkit.org/mailman/listinfo/templates
Re: [Templates] Template Toolkit verion 2.10
On Mon, 4 Aug 2003, Andy Wardley wrote: Alex Vandiver wrote: Also, what are the chances of getting the docs at http://www.template-toolkit.org/docs/ updated to 2.10? Done. P.S. The MIT homepage now uses TT2 to regenerate 300+ pages of static HTML per day. Whee! Cool! Fwiw, I've just completed a redesign of the OSDL website - 324 pages of content being regenerated on demand by TT2. Bryce ___ templates mailing list [EMAIL PROTECTED] http://lists.template-toolkit.org/mailman/listinfo/templates
[Templates] Reverse a list?
Is there a way to reverse the order of a foreach loop? I did not see mention of it on the Template::Iterator manpage or elsewhere... Basically what I'm trying to do is iterate through a directory's contents in reverse order. I.e., something like: [%- USE dir = Directory($ttree_absdir/homepage) -%] [%- FOREACH file = reverse(dir.files) %] [%- INCLUDE file.name %] [%- END %] Thanks, Bryce ___ templates mailing list [EMAIL PROTECTED] http://lists.template-toolkit.org/mailman/listinfo/templates
RE: [Templates] Reverse a list?
Aha! Perfect, thanks! On Mon, 28 Jul 2003, Peter Guzis wrote: Use the reverse virtual method. [%- USE dir = Directory($ttree_absdir/homepage) -%] [%- FOREACH file = dir.files.reverse %] [%- INCLUDE file.name %] [%- END %] Peter Guzis Web Administrator, Sr. ENCAD, Inc. - A Kodak Company email: [EMAIL PROTECTED] www.encad.com -Original Message- From: Bryce Harrington [mailto:[EMAIL PROTECTED] Sent: Monday, July 28, 2003 1:03 PM To: [EMAIL PROTECTED] Subject: [Templates] Reverse a list? Is there a way to reverse the order of a foreach loop? I did not see mention of it on the Template::Iterator manpage or elsewhere... Basically what I'm trying to do is iterate through a directory's contents in reverse order. I.e., something like: [%- USE dir = Directory($ttree_absdir/homepage) -%] [%- FOREACH file = reverse(dir.files) %] [%- INCLUDE file.name %] [%- END %] Thanks, Bryce ___ templates mailing list [EMAIL PROTECTED] http://lists.template-toolkit.org/mailman/listinfo/templates ___ templates mailing list [EMAIL PROTECTED] http://lists.template-toolkit.org/mailman/listinfo/templates ___ templates mailing list [EMAIL PROTECTED] http://lists.template-toolkit.org/mailman/listinfo/templates
Re: [Templates] EtText 2 TT2? (Std widget library/api)
On Tue, 11 Jun 2002, Andy Wardley wrote: On Sat, Jun 08, 2002 at 03:51:54PM -0700, Bryce Harrington wrote: Has anyone developed a listing of standard macro-names (i.e., and API) for common template-toolkit snippets (i.e. widgets)? Kind of. The HTML and Splash template libraries achieve something like this. Although it's an ad-hoc standard, it is at least a reasonably well-defined interface to code against. ... The TT docs (in the 'docs' directory) are an (ugly) example of this. You can go and tweak the templates in docs/lib and build the documentation in a different style if you like *Nod* Okay, sounds like the direction I want to go. In fact the splash skinning approach has been sort of an inspiration for me on this. I guess the way I'd like to see this extended is to have a standardish TT2 skin API that I could make ettext (or other wiki-like converters) speak in. This way, one could write the site's contents in an arbitrary kind of structured text, convert it into this neutral templated language, and then apply the look and feel template skin atop it. Sort of CSS-by-brute-force but more flexible. I will research and try to think about how I can extract/derive a general process/mechanism for writing converters like these, and spec up a skin-neutral TT2 syntax they can output to. Looks like some really good ideas are being explored. There are all sorts of useful widgets like this that should be part of the HTML, Splash, or some other library, but aren't. It's easy to add new widget templates, but we're starting to hit a complexity barrier with the current approach. The Splash! templates, for example, already contain way too many code-like directives that should really be handled by a plugin, or better yet, a view. Could you elaborate on this? I saw some references in going through the mail archives about where one should draw the line between doing it in TT2 vs. Perl. Is there a pointer to something that expresses your official philosophy for TT2 with respect to what should be done in template syntax vs. what ought to be in code? It also allows me to define all my metadata and document structure information in one place (a blechXML/blech file) and then process this to build various index pages, navigation components, menus, etc., automagically. This is very cool. WebMake does things similarly (tho I think TT2 is better on the extensibility front). I investigated using WebMake with TT2 as a general purpose build driver (my needs were more sophisticated than ttree could do), but ended up rolling my own cobbled together build system. Hmm, yet another area I'd like to explore further some day. Have you looked into WebMake or other existing build tools for features to add (or replace) ttree? I take it most people end up crafting something to suit their particular needs when they outgrow ttree? Stas Bekman had taken the issue of building document sets a good few steps further for the modperl 2 docs. A script then walks the directory, examining the config files, scanning directories, processing and copying files, and doing all sorts of other magic to build a final document system, complete with navigation, menus, etc. Hmm, interesting, yeah I should like to look into that. I wrote up a similar system myself that we use at OSDL but it's way too kludgy to be of general use yet, and have been intending to find a more general purpose solution for quite some time now. (Our driving requirement was to be able to easily build test and development versions of the site, and be able to build the site on one machine (behind the firewall) and rsync it out to production machine.) Cool, okay thanks; this gives me lots of meat to chew on. Bryce
Re: [Templates] EtText 2 TT2?
On Mon, 10 Jun 2002, Curtis Poe wrote: Along the same vein, has anyone linked TT2 with a structured-text processor like STX or EtText? What I'm thinking of is a system where an end user can submit content in lightly-formatted plain text and instead of converting it directly to HTML (via ettext2html), runs it through one of a set of processors that can convert it to a standardish TT2 syntax, and then use template toolkit to render the HTML using a site-specific TT2-based style macro library. Mabye build on chromatic's Text::WikiFormat? I thought it used TT2, it seems not, but still ... http://search.cpan.org/search?mode=modulequery=Text%3A%3AWiki Ooh, good pointer, I'll play with this. I was just chatting with chromatic about this. Text::WikiFormat is used with the Slash wiki and there should be no problem hooking it up. More detailed info can be found in chromatic's article on this: http://www.onlamp.com/pub/a/onlamp/2002/01/17/slash_plugin.html Very interesting, but unfortunately the inversion of what I'm looking to do - this appears to plug Wiki into TT2, whereas I essentially want to plug TT2 into Wiki. Still, way cool to see work being done along these lines. Thanks guys, I think I'll try to hack together something and post back here when ready, in case anyone else can make use of such a thing. Bryce
[Templates] EtText 2 TT2? (Std widget library/api)
Has anyone developed a listing of standard macro-names (i.e., and API) for common template-toolkit snippets (i.e. widgets)? Along the same vein, has anyone linked TT2 with a structured-text processor like STX or EtText? What I'm thinking of is a system where an end user can submit content in lightly-formatted plain text and instead of converting it directly to HTML (via ettext2html), runs it through one of a set of processors that can convert it to a standardish TT2 syntax, and then use template toolkit to render the HTML using a site-specific TT2-based style macro library. The motivation for this is probably pretty obvious: my content submitters don't know HTML and probably wouldn't be bothered to learn TT2 syntax either but do seem to groove on wiki-style syntaxes. Unfortunately, the site uses various stylistic elements for representing headers, data tables, etc. that I do as TT2 macros (marketing is talking about doing a sitewide redesign in the near future, so I need the abstraction). Bryce