Template Toolkit入门(一)

 

为什么使用Template Toolkit?

 

什么是Template Toolkit?有人可能开始会说TT“也是另一种模板系统”,但那就好比说蒙娜丽莎是另一副画一样。

简单的说,是一个模板系统提供的一种用值取代占位符的方法。最简单的模板系统是一个perl行。

 

  my %v = (first => 'Randal', last => 'Schwartz');
  my $text = 'My name is <first> <last>.';
  ## here it comes:
  $text =~ s/<(/w+)>/$v{$1}/g;
....(待续)

 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Description: Among the many different approaches to "templating" with Perl--such as Embperl, Mason, HTML::Template, and hundreds of other lesser known systems--the Template Toolkit is widely recognized as one of the most versatile. Like other templating systems, the Template Toolkit allows programmers to embed Perl code and custom macros into HTML documents in order to create customized documents on the fly. But unlike the others, the Template Toolkit is as facile at producing HTML as it is at producing XML, PDF, or any other output format. And because it has its own simple templating language, templates can be written and edited by people who don't know Perl. In short, the Template Toolkit combines the best features of its competitors, with ease-of-use and flexibility, resulting in a technology that's fast, powerful and extensible, and ideally suited to the production and maintenance of web content and other dynamic document systems. In Perl Template Toolkit you'll find detailed coverage of this increasingly popular technology. Written by core members of the technology's development team, the book guides you through the entire process of installing, configuring, using, and extending the Template Toolkit. It begins with a fast-paced but thorough tutorial on building web content with the Template Toolkit, and then walks you through generating and using data files, particularly with XML. It also provides detailed information on the Template Toolkit's modules, libraries, and tools in addition to a complete reference manual. Topics in the book include: * Getting started with the template toolkit * The Template language * Template directives * Filters * Plugins * Extending the Template Toolkit * Accessing databases * XML * Advanced static web page techniques * Dynamic web content and web applications The only book to cover this important tool, Perl Template Toolkit is essential reading for any Perl programmer who wants to create dynamic web content that is remarkably easy to maintain. This book is your surefire guide to implementing this fast, flexible, and powerful templating system.

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值