Questions tagged [template-toolkit]

The Template Toolkit is a fast, flexible and, highly extensible template processing system for Perl. There are also Python and JavaScript implementations.

The Template Toolkit is a fast, flexible and highly extensible template processing system. It is Free (in both senses: free beer and free speech), Open Source software and runs on virtually every modern operating system known to man. It is mature, reliable and well documented, and is used to generate content for countless web sites ranging from the very small to the very large.

It is written in the Perl programming language but you don't need to know any Perl to use it. In fact, it was specifically created to allow web designers and developers to concentrate on generating web pages without getting bogged down in programming matters. We call this a "Clear Separation of Concerns" and it makes the whole processes of building, updating and maintaining a web site or web application significantly easier.

References:

266 questions
4
votes
2 answers

How can I delete variable in Template Toolkit?

Looking at Template::Manual::VMethods section of the Template Toolkit manual I don't see any method doing this. Also assigning undef to variable doesn't work - variable.defined returns true after the fact.
Piotr Dobrogost
  • 41,292
  • 40
  • 236
  • 366
4
votes
1 answer

Is there a common intersection of Smarty and Template Toolkit?

In some projects I have to work with Perl and Template Toolkit and in others with PHP and Smarty templates. Can you somehow configure both to have a common subset of each language, so you can use the same templates in smarty and in template toolkit?…
Jakob
  • 3,570
  • 3
  • 36
  • 49
4
votes
1 answer

Perl Template Toolkit - how to join / concat multiple variables (into one)

Perl Template Toolkit - how to join / concat multiple variables (into one) for example wanting it when selecting the chosen element in a html select field/combo. I found the question here…
FantomX1
  • 1,577
  • 2
  • 15
  • 23
4
votes
2 answers

How to differentiate between false and defined values in Template Toolkit for perl

This is a question about Template Toolkit for perl. I render my templates with a little command-line utility that has the following option enabled DEBUG => Template::Constants::DEBUG_UNDEF, The syntax is render var1 val1 var2 val2…
az5112
  • 590
  • 2
  • 11
4
votes
1 answer

Can I search resultset from within a toolkit template file?

I use Catalyst and put a resultset into the stash for TT to access: $c->stash->{tournament} = $c->model('DB::Tournament')->find($id); This class has a relationship with "tournament_participant" which I access from inside a TT page like this: [%…
Gunnar
  • 351
  • 2
  • 9
4
votes
1 answer

Is it possible to use TT2 with Cro?

I am thinking of using perl6 and Cro to build a website with text content. Is there any best practice / guidance on using Cro with a template toolkit such as TT2 and code examples for me to leverage?
librasteve
  • 6,832
  • 8
  • 30
4
votes
2 answers

How to include Template::Toolkit- Macros?

This question is about the usage of macros from Template::Toolkit (Perl) I`m failing to write macros and putting them into a separate file to use them within several other template files. My macros are located in a separate template file named…
hoppfrosch
  • 581
  • 5
  • 12
4
votes
1 answer

How do I use multiple Template Toolkit TTSite views on a Catalyst site?

I use Template Toolkit to generate views of pages in Catalyst. To do some basic Ajax, I want to have some output pages not use the TTSite style, but a much more basic structure. Do I put something special into the stash to use a .tt2 file without…
Thelema
  • 14,257
  • 6
  • 27
  • 35
4
votes
2 answers

Generating HTML dynamically in modern Perl web frameworks

What is the "modern Perl" recommended way to generate HTML dynamically? I used to be able to just use CGI::tag ( @attr ), but seems this is deprecated now. However, reading through CGI::Alternatives, I only see examples using static HTML. I suppose…
Arnon Weinberg
  • 871
  • 8
  • 20
4
votes
3 answers

How can I use Template Toolkit on a string instead of a file?

I have some strings that I am pulling out of a database and I would like to use Template Toolkit on them, but I can't seem to figure out how to use strings as TT input. Any tips? Thanks! -fREW
Frew Schmidt
  • 9,364
  • 16
  • 64
  • 86
4
votes
5 answers

Escape Single Quotes in Template Toolkit

Do you ever escape single quotes in template toolkit for necessary javascript handlers? If so, how do you do it. [% SET s = "A'B'C" %] ABC html_entity obviously doesn't work because…
Zach
  • 157
  • 3
  • 7
4
votes
2 answers

How can I switch timezones in Perl's Template::Plugin::Date?

I have a calendar on my website, generated in Perl using Template::Toolkit and Template::Plugin::Date. It highlights the current day. I achieve this by iterating through all the dates (as I print the calendar) and comparing against the current date.…
aidan
  • 9,310
  • 8
  • 68
  • 82
4
votes
3 answers

Perl Logic in Template Toolkit

I have a currency value that I would like to format using Locale::Currency::Format however I have no idea how to format it. Here is my output in Template Toolkit [% amount %] I would like this to be outputted using the following…
KingKongFrog
  • 13,946
  • 21
  • 75
  • 124
4
votes
1 answer

Valid variable name in Template Toolkit

I'm using perl and Template::Toolkit to generate some texts. In the perl program, I defined a hash ref such as my $user = { "user-name" => "John" }; and passed it to Template::Toolkit in order to generate John with the template file. In the…
user1149862
4
votes
1 answer

How to Encode and Decode "Acute accented characters" using Perl

I am working in a web based educational website, where we are using Perl, MySQL 5, Apache and Template Toolkit. we are planning to introduce the support for multiple\ Language in our website. What we have done in IF we have a Tab name like Courses…
Ash_and_Perl
  • 356
  • 5
  • 21