Re: [Templates] setting input checked

2014-12-05 Thread Larry Leszczynski
Hi Bill - On Fri, Dec 5, 2014, at 09:56 AM, Bill McCormick wrote: okay, so now the bitwise *and* is giving me problems: input class=radio type=radio name=recipe_type value=Warmup [% 'checked=1' IF 15 16 %]/Warmup You're doing logical AND, not bitwise AND. You want 15 16. Larry

Re: [Templates] reg exp and removing all data between two strings

2013-07-01 Thread Larry Leszczynski
Hi Summer - I want to omit the tags and everything in between. [% customBlock = BLOCK; 'customTag'; A BUNCH OF TT STUFF '/customTag' %] [% newString = customBLOCK.replace((?i:customTag[.*?]/customTag),); %] First, I think to do the case-insensitive matching you need to have (?i)

Re: [Templates] Newbie question: include all files

2013-06-04 Thread Larry Leszczynski
Hi Gabor - On Tue, Jun 4, 2013, at 08:37 AM, Kiss Gabor (Bitman) wrote: Dear folks, After one and half document reading and web search I can't figure out how to include all files from a directory relative to the main template. This may help you find the current directory for the current

Re: [Templates] somevar = BLOCK and passing switches

2013-05-08 Thread Larry Leszczynski
Hi Summer - [% some_name; token_to_omit =1 %] some_name does not respect that variable token_to_omit Did you try: [% PROCESS some_name token_to_omit=1 %] (No semicolon after some_name.) http://www.template-toolkit.org/docs/manual/Directives.html#section_BLOCK HTH, Larry

Re: [Templates] Using Constants as Hash Keys

2012-11-29 Thread Larry Leszczynski
Hi Stuart - It is a hashref. I just trimmed it down to the minimum that causes the error. To be more clear: [% x = { constants.foo = value } %] Or: [% function({ constants.foo = value }) %] Maybe want something like: [% foo = constants.foo; x = { $foo = value };

Re: [Templates] Problem with global variables

2012-09-17 Thread Larry Leszczynski
Hi Khalid - my $tt = Template-new( { VARIABLES = { username = 'Simba', }, RELATIVE = 1, } ) || die $Template::ERROR\n; I think you want CONSTANTS, not VARIABLES. HTH, Larry ___ templates mailing list

Re: [Templates] ttree not copying

2011-10-18 Thread Larry Leszczynski
Hi Wayne - Recently I noticed that while ttree is processing the .tt files into .html quite fine, it is no longer copying over the ancillary files. Is it possible it thinks they are old and do not need copying? What happens if you touch the file so it looks new? Just a guess... Larry

Re: [Templates] umask of files created in COMPILE_DIR

2011-09-09 Thread Larry Leszczynski
Hi Todd - On Thursday, September 08, 2011 8:31 PM, Todd Wade tr...@sbcglobal.net wrote: touch lets the system set the permissions, File::Temp sets the mode of the file explicitly. Is that accurate? Not exactly... It's true that File::Temp sets the mode of the file explicitly, because it

Re: [Templates] umask of files created in COMPILE_DIR

2011-09-09 Thread Larry Leszczynski
Hi Todd - I'm not seeing a umask being applied when File::Temp creates the file: $ umask 0002 $ perl -MFcntl -e 'sysopen(my $fh, ./sysopened, O_WRONLY | O_APPEND | O_CREAT, 0600)' $ ls -l -rw--- 1 me me 0 Sep 9 10:35 sysopened It is being applied, it just doesn't do anything.

Re: [Templates] Putting an assertion into a TT Template.

2011-08-19 Thread Larry Leszczynski
On Fri, 19 Aug 2011 13:50 +0100, Dave Howorth dhowo...@mrc-lmb.cam.ac.uk wrote: Andrew Black wrote: [...] if myvar != 5 print STDERR 'myvar should be 5, actual $myvar' [...] Dunno, did you try typing template assert into google, which shows

Re: [Templates] DBIx::Class resultsets with 0, 1, 2 items

2011-04-11 Thread Larry Leszczynski
Hi Dave - items = some_resultset_rs.all ; IF items.size 0; 'ul' ; FOREACH item IN items ; 'li' ; item.name ; END ; '/ul' ; END ; and I've tried using items.0.defined but all my attempts work when there are zero items and when there are two or more items, but fail

Re: [Templates] Syntax

2011-03-05 Thread Larry Leszczynski
Hi John - The following does not work: a href=[% c.uri_for_action(/gallery/show, $name) %] In template code if you are outside a quoted string you do not need the dollar sign to get the value of a variable. So here you just need: a href=[% c.uri_for_action(/gallery/show, name) %] If

[Templates] [OT] Re: removing whitespace problem

2011-02-07 Thread Larry Leszczynski
Note: In English, we don't use a, b, and c, but a, b and c Not necessarily: http://en.wikipedia.org/wiki/Serial_comma ___ templates mailing list templates@template-toolkit.org http://mail.template-toolkit.org/mailman/listinfo/templates

Re: [Templates] problem with array and FOEARCH

2010-08-18 Thread Larry Leszczynski
Hi - Adding [% USE dumper; dumper.dump(authors); -%], then it appears: $VAR1=[]; Authors: ARRAY(0x9ff9278) With: [% FOREACH author IN authors %] trtd [% author || No author here %] /td/tr nothing appears. Your authors array is empty. That is why dumper reports it as [] and also

Re: [Templates] problem with array and FOEARCH

2010-08-18 Thread Larry Leszczynski
Try [% authors.size %] and it will likely show up as zero. It outputs 0. I fill array in following way in .cgi script. my $vars = { authors = \...@authorslog; } Missing semicolon at end of this line? $tt2-process('page.html', $vars) || die $tt2-error(); @authorslog is not

Re: [Templates] TT: split is not working, why?

2010-04-20 Thread Larry Leszczynski
Hi Summer - On Tue, 20 Apr 2010 22:09 -0400, Darren Chamberlain d...@sevenroot.org wrote: On Tue, Apr 20, 2010 at 21:57, Summer crazysummer2...@yahoo.com wrote: FOREACH newstr IN thistxtstring.split( '||' ); split takes a regex, so you need to escape the |: FOREACH newstr IN

Re: [Templates] maintain that formatting after including

2009-12-18 Thread Larry Leszczynski
server { stuff [% INCLUDE thing %] } where thing has Foo Bar and end up with server { stuff foo bar } is there anyway to get it so that it is server { stuff foo bar } How about something like (untested): server { stuff [%-

Re: [Templates] Access a macro in all templates?

2009-10-12 Thread Larry Leszczynski
Hi Octavian - Is it possible to define a macro in a single place and access it in all the templates? [cut] Now I just need to find how I can include this in Catalyst... You should be able to put variables, MACROs and BLOCK definitions in a file like my_config_stuff.tt, and then do

Re: [Templates] Recommendations for Perl coder to learn current WWW presentation technologies?

2009-09-03 Thread Larry Leszczynski
On Thu, 03 Sep 2009 13:41 +0200, Alexander Dahl p...@lespocky.de wrote: I don't think books from the last century will help you in questions of modern web design. There's XHTML now and CSS and browsers have gone through evolutional steps since then. For example: you don't use hidden tables or

Re: [Templates] The new xml filter

2009-07-09 Thread Larry Leszczynski
Hi Bill - On Thu, 09 Jul 2009 11:31 -0700, Bill Moseley mose...@hank.org wrote: On Thu, Jul 9, 2009 at 3:16 PM, Bill Ward b...@wards.net wrote: Anyway you probably should be using not ' for the HTML attributes there, to avoid that problem... [cut] and ' are both ok to use Ok in

Re: [Templates] The new xml filter

2009-07-09 Thread Larry Leszczynski
On Thu, 09 Jul 2009 12:48 -0700, Sean McAfee eef...@gmail.com wrote: On Thu, Jul 9, 2009 at 3:39 PM, Larry Leszczynski lar...@emailplus.orgwrote: Hi Bill - On Thu, 09 Jul 2009 11:31 -0700, Bill Moseley mose...@hank.org wrote: and ' are both ok to use Ok in HTML but not XHTML

Re: [Templates] The ghost of templates future

2009-02-17 Thread Larry Leszczynski
Hi Kelly - On Mon, 16 Feb 2009 15:40 -0500, Kelly Thompson kalexthomp...@gmail.com wrote: I see no reason to have external js links, with a template system, other than hiding code. Back in the day, it was nice to be able to edit one js file, and all pages change. With Templates that's

Re: [Templates] Hello all

2008-05-19 Thread Larry Leszczynski
Hi Kelly - On Sun, 18 May 2008, Kelly Thompson wrote: I am trying to create a MACRO that will replace a lot of values within a databased variable. What I have now is this in my config template. Your macro is multiple lines, try enclosing in a BLOCK, e.g.: [% MACRO unescape(text) BLOCK;

Re: [Templates] Editor support page on tt2.org web site

2008-01-18 Thread Larry Leszczynski
On Fri, 18 Jan 2008, Andy Wardley wrote: Thanks to everyone for the information about editor bundles, and thanks especially to all the people who wrote them. I've added a list to the TT2 web site. http://tt2.org/download/index.html#editors Another to add: I've been happy using the TT

Re: [Templates] Templates and AJAX

2006-11-19 Thread Larry Leszczynski
On Sun, 19 Nov 2006, Buddy Burden wrote: We use OpenThought (http://www.openthought.net/) with TT2. [snip] I understand that CGI::Application works well with TT2, but I don't know how difficult it would be to convince the OT code to do that. I have an app built with TT2 and

Re: [Templates] loop.first, loop.last

2006-06-10 Thread Larry Leszczynski
Hi Birgit - I should add that the same template works perfectly with loop.first, except that then of course it doesn't do what I want :-) Sorry this does not solve the question of the loop.last error message, but if loop.first works maybe you could do something like: % foreach record in

Re: [Templates] TT + JSON + AJAX == profit

2006-02-17 Thread Larry Leszczynski
On Fri, 17 Feb 2006, Nik Clayton wrote: This is an idle musing, prompted in part by http://www.tbray.org/ongoing/When/200x/2006/02/14/AJAX-Performance Has anyone ever considered implementing a Javascript engine for the TT syntax? I rather fancy the idea of offloading the template processing

Re: [Templates] CHOMP feature request

2006-02-16 Thread Larry Leszczynski
On Thu, 16 Feb 2006, Andy Wardley wrote: With '-' and '+' it's fairly clear (once you know what they do) that '-' removes whitespace and '+' leaves it alone. The same is also true of '=' for collapsing, if you think of it as two '-' signs with a space between them. That's also analogous to

Re: [Templates] Template can not use overloaded @{} operator

2006-02-01 Thread Larry Leszczynski
Hi Gernot - and where mytemplate.txt looks like [% c %] [% FOREACH x = c %] [% x %] [% END %] Did you mean : [% FOREACH x IN c %] ? Larry ___ templates mailing list templates@template-toolkit.org

Re: [Templates] equals ignore case

2005-12-16 Thread Larry Leszczynski
On Fri, 16 Dec 2005, Phil Mitchell wrote: Yes, I did PROCESS my macros.tt, but it was inside header.tt, which got INCLUDED. Changing the outer inclusion to PROCESS solved. I'm coming to the conclusion that I should PROCESS everything, and leave INCLUDE for optimization time ... Actually,

Re: [Templates] PPM for CGI::Application::Plugin::TT ?

2005-10-27 Thread Larry Leszczynski
On Thu, 27 Oct 2005, Randy Kobes wrote: Yes, I saw it at cpan.uwinnipeg.ca, but no PPM. That's why I wanted to ask if anyone had built one before submitting a request. Actually, I did see this messsage, and put up a ppm package under http://theoryx5.uwinnipeg.ca/ppms/. It'll be reflected

Re: [Templates] a little text formatting

2005-03-15 Thread Larry Leszczynski
On Tue, 15 Mar 2005, Cahill, Earl wrote: A start with a line, say This line is really too long. A length, say 25, and suffix, say '...'. I would like to be able to do something like this [% my_truncate(line, 25, '...') %] And end up with This line is really t... Um, maybe you

Re: [Templates] processing template chunks in parallel

2005-03-08 Thread Larry Leszczynski
On Mon, 7 Mar 2005, Perrin Harkins wrote: Cahill, Earl wrote: 1. TT parses the page and does all tags, except those containing a priority 2. I get, say, an array ref of hash refs, corresponding to the tags for an entire page (since priorities don't necessarily match

Re: [Templates] access to the hash passed into the template

2005-01-31 Thread Larry Leszczynski
Time), Larry Leszczynski [EMAIL PROTECTED] wrote: Hi j - is there a way to Dump the hash passed into your template from within your template? -j http://template-toolkit.org/docs/default/Modules/Template/Plugin/Dumper.html HTH, Larry

Re: [Templates] access to the hash passed into the template

2005-01-30 Thread Larry Leszczynski
Hi j - is there a way to Dump the hash passed into your template from within your template? -j http://template-toolkit.org/docs/default/Modules/Template/Plugin/Dumper.html HTH, Larry ___ templates mailing list templates@template-toolkit.org

RE: [Templates] TT in callback

2005-01-06 Thread Larry Leszczynski
control the scoping). So even with Andy's fix to make the localization done by INCLUDE less of a performance hit (which sounds very cool), it might still be worth considering making INCLUDE default to not localize, or add some syntax to allow the user explicitly control the variable scope. Larry

TT Caching (Was: Re: [Templates] TT in callback)

2005-01-05 Thread Larry Leszczynski
as the difference between CGI and PersistentPerl. Is there any way to take advantage of the cache in a non-persistent (e.g. non-webserver) environment? Maybe along the lines of serializing the template object and reading it back later? Just curious, Larry Leszczynski

Re: TT Caching (Was: Re: [Templates] TT in callback)

2005-01-05 Thread Larry Leszczynski
Hi Perrin - Is there any way to take advantage of the cache in a non-persistent (e.g. non-webserver) environment? Maybe along the lines of serializing the template object and reading it back later? No, but the COMPILE_DIR option means that at least the compile to perl step will be

Re: [Templates] Objects as hidden variables?

2004-12-17 Thread Larry Leszczynski
want to make it safe to put in an HTML page). HTH, Larry Leszczynski ___ templates mailing list [EMAIL PROTECTED] http://lists.template-toolkit.org/mailman/listinfo/templates

[Templates] Passing a list to DBI execute?

2004-12-06 Thread Larry Leszczynski
the template that does the prepare/execute. Is there some sort of dereferencing or eval-ing that I need to do to get the bind_params list passed through to execute? Thanks, Larry Leszczynski ___ templates mailing list [EMAIL PROTECTED] http://lists.template