开发者

variable nested templates in cheetah

i have a base template that calls a nested template based on a variable passed in, eg.

page = 6

and what i want is to call some html as follows:

...
<div>
    #include "templates/_page${page}.tmpl"
</div>
...

what is the correct syntax for this? thanks.

PS. i 开发者_开发问答have managed this:

#if $page.id == 6
    #include "templates/_page6.tmpl"
#end if

but any improvement welcome


well, all it took was a few nights sleep but i got a solution:

#include "templates/_page"+str($page)+".tmpl"

i slightly expanded the code and it works. HTH

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜