Template Toolkit
<p>Template Toolkit 是一个快速、灵活和高可扩展的模板处理系统。可以用来处理各种规模的网页</p> <p>下面是 Perl 使用该工具的例子:</p> <p>模板文件内容:</p> <pre class="brush:perl; toolbar: true; auto-links: false;">Dear [% name %], It has come to our attention that your account is in arrears to the sum of [% debt %]. Please settle your account before [% deadline %] or we will be forced to revoke your Licence to Thrill. The Management.</pre>源程序: <pre class="brush:perl; toolbar: true; auto-links: false;">use Template; my $tt = Template->new({ INCLUDE_PATH => '/usr/local/templates', INTERPOLATE => 1, }) || die "$Template::ERROR\n"; my $vars = { name => 'Count Edward van Halen', debt => '3 riffs and a solo', deadline => 'the next chorus', }; $tt->process('letters/overdrawn', $vars) || die $tt->error(), "\n";</pre> <p><strong>项目主页:</strong><a href="http://www.open-open.com/lib/view/home/1322984353531" target="_blank">http://www.open-open.com/lib/view/home/1322984353531</a></p> <p></p>
本文由用户 openkk 自行上传分享,仅供网友学习交流。所有权归原作者,若您的权利被侵害,请联系管理员。
转载本站原创文章,请注明出处,并保留原始链接、图片水印。
本站是一个以用户分享为主的开源技术平台,欢迎各类分享!