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
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
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
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
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
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:
>
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
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
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
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
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
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
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
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
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
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
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
> > <% 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
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
> <% 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
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
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
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
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
Hello,
has anybody written a TT2 syntax highlighting file for Emacs?
Good bye,
Uwe
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
> 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
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:
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 !
> 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
> 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
* 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
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.
> [% 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
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, '
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
36 matches
Mail list logo