Hello [% a = 3 %]这个输出的话为“Hello \nWorld 3\n”。而这么写可以把里面的 \n 去掉:
World [% a %]
Hello [% a = 3 -%]输出为“Hello World 3”。这个在 http://www.stonehenge.com/merlyn/LinuxMag/col60.html 里提到过。
World [% a -%]
[% user.name %][% END %]可以写成
[% user.name; END %]
Copyright 2004-2005 All Rights Reserved. Powered by <a href="Eplanet.html">Eplanet</a> && <a href='http://catalyst.perl.org'>Catalyst</a> [% CatalystVersion %].当在另一个文件中调用 [% INSERT footer.tt %] 时输出的结果跟上面的会一样。里面的 [% CatalystVersion %] 是原封不动。而假如是用 [% INCLUDE footer.tt %] 的话里面的 [% CatalystVersion %] 会被执行为这个变量的值。
[% show_guidebar = BLOCK %]
<p>
[% IF prev_topic %]<<Previous: <a href="[% prev_topic.cms_file %].html">[% prev_topic.cms_title %]</a>[% END %]
[% IF prev_topic and next_topic %] [% END %]
[% IF next_topic %]>>Next: <a href="[% next_topic.cms_file %].html">[% next_topic.cms_title %]</a>[% END %]
</p>
[% END %][% show_guidebar %]
...
[% show_guidebar %]
[%# a = 77输出 a: b:
b = 88
%]
a: [% a %] b: [% b %]
[% # a = 77输出 a: b: 88
b = 88
%]
a: [% a %] b: [% b %]
评论加载中…
![]() |