Re: [Templates] Syntax

2011-03-05 Thread Octavian Rasnita
From: "Mike Raynham" > On 05/03/11 11:06, John M. Dlugosz wrote: >> The following does not work: >> >> but through trying different things, I found that this does: >> ..., "$name")... >> why? What is the first line interpreted as? It doesn't give any error. It >> would seem to pr

Re: [Templates] Syntax

2011-03-05 Thread Larry Leszczynski
Hi John - > The following does not work: > 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: If you are inside a quoted string, you use the dollar sign to get the value: "My name is $name" w

Re: [Templates] Syntax

2011-03-05 Thread Mike Raynham
On 05/03/11 11:06, John M. Dlugosz wrote: > The following does not work: > > but through trying different things, I found that this does: > ..., "$name")... > why? What is the first line interpreted as? It doesn't give any error. It > would seem to produce no second argument at all

[Templates] Syntax

2011-03-05 Thread John M. Dlugosz
The following does not work: but through trying different things, I found that this does: ..., "$name")... why? What is the first line interpreted as? It doesn't give any error. It would seem to produce no second argument at all. ___ templ

Re: [Templates] syntax problems with Template::DBI

2008-11-13 Thread M
On Thu, Nov 13, 2008 at 01:02:11PM +, M wrote: >On Wed, Nov 12, 2008 at 07:18:12PM +, Andy Wardley wrote: >>http://template-toolkit.org/svnweb/Template-DBI/diff/trunk/lib/Template/Plugin/DBI.pm?rev1=1;rev2=2 >> >>You can check out the latest version like so: >> >> $ svn co svn://svn.tt2.o

Re: [Templates] syntax problems with Template::DBI

2008-11-13 Thread M
On Wed, Nov 12, 2008 at 07:18:12PM +, Andy Wardley wrote: > >Josh Rosenbaum wrote: >>My guess is that the execute() routine does not handle an arrayref being >>passed > >Your guess would be correct. My bad. h I found real bug, or misimplemented feature at least. >>Possible Solutions: >

Re: [Templates] syntax problems with Template::DBI

2008-11-12 Thread Andy Wardley
Kelly Thompson wrote: > I suggest you move the DBI interaction into the perl, script. > Just a thought... For most applications, yes, a clear separation of concerns is a Good Thing[tm]. But then the DBI plugin exists specifically for those occasions when you can't, don't want to, or don't need to

Re: [Templates] syntax problems with Template::DBI

2008-11-12 Thread Kelly Thompson
I suggest you move the DBI interaction into the perl, script. Just a thought... On Wed, Nov 12, 2008 at 2:18 PM, Andy Wardley <[EMAIL PROTECTED]> wrote: > Josh Rosenbaum wrote: > > My guess is that the execute() routine does not handle an arrayref being > passed > > Your guess would be correct

Re: [Templates] syntax problems with Template::DBI

2008-11-12 Thread Andy Wardley
Josh Rosenbaum wrote: > My guess is that the execute() routine does not handle an arrayref being > passed Your guess would be correct. My bad. > Possible Solutions: *) Get Andy to fix it I've committed a fix to the subversion repository. http://template-toolkit.org/svnweb/Template-DBI/diff/t

Re: [Templates] syntax problems with Template::DBI

2008-11-12 Thread Josh Rosenbaum
M wrote: [SNIP] > [% FOREACH customer = main.execute(bind) %] [SNIP] > But When I run it I get > > [Wed Nov 12 18:16:43 2008] [error] [client 92.41.135.118] DBI error - > execute failed: called with 1 bind variables when 2 are needed, referer: > http://test > > I've been wondering if I

[Templates] syntax problems with Template::DBI

2008-11-12 Thread M
Hello again, Sorry to bother again, but I've been fiddling with this for the best part of today and don't seem to be getting anywhere. http://search.cpan.org/~abw/Template-DBI-2.64/lib/Template/Plugin/DBI.pm says that the execute function takes an array for the bind values execute(@args) I've

Re: [Templates] Syntax question

2007-05-09 Thread Bill Moseley
On Wed, May 09, 2007 at 01:41:50PM +0100, Andy Wardley wrote: > Bill can't seem to do this: > > content WRAPPER outter.tt + $page; > > That's a bug/limitation in the TT2 parser. Glancing at the grammar, > it looks like it might be fixable. But I've got a nagging doubt that > it's not as straig

Re: [Templates] Syntax question

2007-05-09 Thread Andy Wardley
Bill can't seem to do this: > content WRAPPER outter.tt + $page; That's a bug/limitation in the TT2 parser. Glancing at the grammar, it looks like it might be fixable. But I've got a nagging doubt that it's not as straightforward as it looks at first glance. I'll glance deeper when I get a mo

[Templates] Syntax question

2007-05-08 Thread Bill Moseley
I can do this: content WRAPPER outer.tt + inner.tt; and this: page = 'stuff.tt'; content WRAPPER $page; but I can't seem to do this: content WRAPPER outter.tt + $page; I can use nested WRAPPERs, but I'm curious if there's a way to do the above. -- Bill Moseley [EMAIL PROTE

[Templates] Syntax highlighting for Template Toolkit in gedit

2006-09-28 Thread Clinton Gormley
Here's a syntax highlighter for gedit running in Gnome. it's not perfect, but gnu-regexes are fairly limited in comparison with what we have in Perl. Any my mime stuff is probably not the recommended way of doing it. However, it works for me (at least it does on SuSE 10.1) I have assigned a made

[Templates] syntax checking template on pre-commits

2006-09-11 Thread Bill Moseley
Anyone using a pre-commit hook in subversion to test for syntax errors in templates? I wondering if it might help a client prevent checking in a broken site-wide template. I'm releasing an application to a client. They are a small organization with limited technical expertise. In the past they

Re: [Templates] Syntax question

2005-09-13 Thread Birgit Kellner
Jason Gottshall wrote: I'd go with Mark's simple concatenation, but just to be thorough, it should be noted that you can interpolate vars in a string using double-quotes and a dollar sign, with added curly braces to clearly delineate references: <% set printed_lastname = "${g.firstname} ${g.las

RE: [Templates] Syntax question

2005-09-13 Thread Jason Gottshall
> > <% set printed_lastname = 'g.firstname g.lastname' %># interprets > > variable values as literals > > <% set printed_lastname = g.firstname g.lastname %># produces > > syntax error > > Maybe > <% set printed_name = g.firstname _ g.lastname %> I'd go with Mark's simple concatenation, but jus

Re: [Templates] Syntax question

2005-09-13 Thread Birgit Kellner
Thomas, Mark - BLS CTR wrote: Maybe <% set printed_name = g.firstname _ g.lastname %> - Mark. Brilliant! Thanks, this works perfectly, Birgit ___ templates mailing list templates@template-toolkit.org http://lists.template-toolkit.org/mailma

RE: [Templates] Syntax question

2005-09-13 Thread Thomas, Mark - BLS CTR
> <% set printed_lastname = 'g.firstname g.lastname' %># interprets > variable values as literals > <% set printed_lastname = g.firstname g.lastname %># produces > syntax error Maybe <% set printed_name = g.firstname _ g.lastname %> - Mark. ___ te

[Templates] Syntax question

2005-09-13 Thread Birgit Kellner
This is a general syntax question - apologies if it is too general for this list. In a foreach-loop through a list of information about persons, I want to print out the name of a person only if no entry for that person has been printed before. This is the case if no entry with precisely the sa

Re: [Templates] Syntax-Highlighting for (X)Emacs?

2002-06-15 Thread Dave Cross
On Sat, Jun 15, 2002 at 02:57:44PM +0100, Dave Cross ([EMAIL PROTECTED]) wrote: > On Fri, Jun 14, 2002 at 10:35:03AM +0200, Uwe Voelker ([EMAIL PROTECTED]) wrote: > > Hello, > > > > has anybody written a TT2 syntax highlighting file for Emacs? > > My tt-mode.el file is attached. Currently, it si

Re: [Templates] Syntax-Highlighting for (X)Emacs?

2002-06-15 Thread Dave Cross
On Fri, Jun 14, 2002 at 10:35:03AM +0200, Uwe Voelker ([EMAIL PROTECTED]) wrote: > Hello, > > has anybody written a TT2 syntax highlighting file for Emacs? My tt-mode.el file is attached. Currently, it simply highlights anything that matches [% ... %] as a keyword, but it's a start. If anyone ha

Re: [Templates] Syntax-Highlighting for (X)Emacs?

2002-06-14 Thread F . Xavier Noria
On Fri, 14 Jun 2002 10:35:03 +0200 Uwe Voelker <[EMAIL PROTECTED]> wrote: : has anybody written a TT2 syntax highlighting file for Emacs? I use this poor man's highlighting: (defun highlight-tt2 () (interactive) (highlight-regexp "\\[%[^%]+%\\]" 'font-lock-builtin-face)) (global-set-key (kb

[Templates] Syntax-Highlighting for (X)Emacs?

2002-06-14 Thread Uwe Voelker
Hello, has anybody written a TT2 syntax highlighting file for Emacs? Good bye, Uwe

[Templates] Syntax File for TT + HTML

2002-06-06 Thread Stathy G. Touloumis
Another developer I work with added HTML syntax highlighting to the template.vim file if anyone may find it useful. Stathy G. Touloumis Lead Programmer, Benchmarks Edison Schools, Inc. Ph: 847.676.6663 > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED]]On Behalf

Re: Re: [Templates] Syntax checking

2001-08-03 Thread Oleg Burlaca
> my $context = $template->context(); > my $compiled; > eval { > $compiled = $context->template('filename'); > }; > if ($@) { # Bad Template! } > else { > # Good Template! > $template->process($compiled); > } > It worked. Thanks ! (I store tmpl's in a DB, and want to

Re: [Templates] Syntax checking

2001-08-03 Thread Andy Wardley
On Fri, Aug 03, 2001 at 12:28:21PM +0300, Oleg Burlaca wrote: > I'd like to see if the template is ok(almost ok) before some script uses it. If you fetch a reference to the context object: my $context = $template->context(); you can then pre-fetch a template to see if it compiled or not:

[Templates] Syntax checking

2001-08-03 Thread Oleg Burlaca
Hi all! is it possible to check if a template conforms to TT rules ? I mean something like Template->syntax_check($tmpl_file). I'd like to see if the template is ok(almost ok) before some script uses it. Thanks !

Re: [Templates] syntax problem?

2001-07-30 Thread Perrin Harkins
> P.S. How can i merge some textual variables into one? In perl it's looks > like > > var1 = var2 . var3, or var1 = "text1" . "text2" (you get the point) > > but in TT it doesn't seem to work and in docs i didn't find any examples > too. You can do this. I forget whether or not the standard conc

Re: [Templates] syntax problem?

2001-07-30 Thread Viljo Marrandi
> Which looks like it translates to: > > [% sql = 'SELECT * FROM table WHERE type = ? AND headline LIKE ?' %] > [% query = DBI.prepare( sql ) %] > [% FOREACH blah = query.execute( 'type', '%headline%' ) %] > ... > [% END %] That worked, thanks. I hope this will be my last question today. Now

Re: [Templates] syntax problem?

2001-07-30 Thread Chris Winters
* Viljo Marrandi ([EMAIL PROTECTED]) [010730 10:29]: > > [% FOREACH result = DBI.query('SELECT DATE_FORMAT(now(), \'%M %d\') as now') > > %] > > Time is [% result.now %] > > [% END %] > > > Got it working, thanks. But now i have another question. Let's say i > want to make this query: > > SELE

RE: [Templates] syntax problem?

2001-07-30 Thread Stephen Howard
onday, July 30, 2001 10:12 AM To: templates Subject: Re: [Templates] syntax problem? > [% FOREACH result = DBI.query('SELECT DATE_FORMAT(now(), \'%M %d\') as now') > %] > Time is [% result.now %] > [% END %] Got it working, thanks. But now i have another question.

Re: [Templates] syntax problem?

2001-07-30 Thread Viljo Marrandi
> [% FOREACH result = DBI.query('SELECT DATE_FORMAT(now(), \'%M %d\') as now') > %] > Time is [% result.now %] > [% END %] Got it working, thanks. But now i have another question. Let's say i want to make this query: SELECT * FROM table WHERE type = ? AND headline LIKE '%?%' Then hows this co

RE: [Templates] syntax problem?

2001-07-27 Thread Matthews Simon
7;%M %d\') as now') %] Time is [% result.now %] [% END %] Regards Simon -Original Message- From: Viljo Marrandi [mailto:[EMAIL PROTECTED]] Sent: 27 July 2001 11:46 To: [EMAIL PROTECTED] Subject: [Templates] syntax problem? Hello, I have this query: SELECT DATE_FORMAT(time, '

[Templates] syntax problem?

2001-07-27 Thread Viljo Marrandi
Hello, I have this query: SELECT DATE_FORMAT(time, '%M %d') AS time FROM table, which works fine in mysql prompt. If i try to use it from [% FOREACH result = DBI.query('SELECT...') then i get this error to erro_log: line 5: unexpected token (%M) How do i use it then? I tried to escape this