$ cat main.tt
[% INCLUDE include.tt lastn=3 %]
$ cat include.tt
[% i = 0 -%]
[% WHILE i < lastn -%]
<div>article [% i + 1 %]</div>
[% i = i + 1 -%]
[% END -%]
$ tpage main.tt
<div>article 1</div>
<div>article 2</div>
<div>article 3</div>
2008/10/18 Silent <silent2600@gmail.com>:
> 这个只能insert普通文件,
> 我想要的是类似mt里的,刚看了一下mt网站:
> <mt:entries lastn="40">
> <mt:entrytitle />
> </mt:entries>
> 然后他就自动去数据库里拿来最新的40条数据
>
>
> 2008/10/18 islue <islue.hu@gmail.com>:
>> TT2可以满足这样的需求,具体实现见文档:
>> http://search.cpan.org/~abw/Template-Toolkit-2.20/lib/Template/Manual/Directives.pod#Processing_Template_Files_and_Blocks
>>
> _______________________________________________
> China-pm mailing list
> China-pm@pm.org
> http://mail.pm.org/mailman/listinfo/china-pm
_______________________________________________
China-pm mailing list
China-pm@pm.org
http://mail.pm.org/mailman/listinfo/china-pm
没有评论:
发表评论