On Fri, Apr 3, 2009 at 8:29 PM, Sean McAfee <[email protected]> wrote:
> In this example, the template does not render, giving a blank page instead. >> If I remove the PROCESS directive entirely and replace it with raw text the >> template functions. >> >> [% SWITCH myswitch; >> CASE 'yes'; >> [% PROCESS yeserror %] >> > > You're already in a template block, so you don't need the block delimiters > around PROCESS. > > Be sure to check the return value from $template->process() to know if > there was an error. I get this error when I try to process your original > template: > > file error - parse error - input file handle line 1-3: unexpected token (%) > Thanks muchly, Sean & Stephen, for your help. I managed to get it working and picked up some tips on debugging TT templates along with it. If anybody is able to help I have one other question. As I said, we're trying to translate our website into other languages and make it easier for volunteers to do the translations without having to read over lots of template code. We have split out all translateable text strings into BLOCKS, which commence below the named according to a somewhat uniform naming convention (starting with '_txt_'). At this point we can use sed or similar to easily extract all these blocks and dump them in an email to the translator - the tricky part potentially comes with re-combining the new translations (unless one does it by hand). My idea is to split each template into both a layout file and a 'strings' file. Basically, all the _txt_ blocks for a given template becoming the 'strings' and being cut out of the file and saved into another directory/file with a name which derived from the requested template. One way to make this work would be by modifying each template to PROCESS template.name_strings but this would require modifying every single template. Another way might be to always process() a single generic 'wrapper' template, passing it some variables including the template name, from which it would derive the filename of the translations/strings file. Neither of these are appealing to our IT team, so I was wondering if there was another way to combine the 'layout' templates with the text strings files? Cheers Howard
_______________________________________________ templates mailing list [email protected] http://mail.template-toolkit.org/mailman/listinfo/templates
