Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个基本模板,它根据传入的变量调用嵌套模板,例如。
page = 6
我想要的是调用一些html如下:
... <div> #include "templates/_page${page}.tmpl" </div> ...
什么是正确的语法?谢谢。
PS。我已经做到了:
#if $page.id == 6 #include "templates/_page6.tmpl" #end if
但欢迎任何改进
好吧,只需要睡几个晚上,但我有一个解决方案:
#include "templates/_page"+str($page)+".tmpl"
我稍微扩展了代码,它可以工作。高温高压