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
精彩评论