-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
老雷 #48
Comments
为嘛关掉呢? |
后来仔细想了想,好像也没啥高上大的内容 |
可以作为一个light topic. 5分钟演讲。 在 2014年4月15日,下午4:22,雷宗民 [email protected] 写道:
|
reopen 的好啊,真想聽聽 @leizongmin 的 lightining talk. |
支持 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Github: @leizongmin
Topic: 异步的模板引擎
Weibo: @雷宗民
介绍一个可以在模板中调用异步函数的模板引擎 tinyliquid 和简单的应用
比如,在PHP中,如果要在模板中输出某个用户ID的昵称,可能会这样写:
如果是在Node.js中,则需要在渲染模板之前查询出来:
然后才能才模板中使用:
某些可以允许用户自己修改模板的场合,只能把所有可能用到的数据查询出来,然后再渲染。
而使用 tinyliquid 模板引擎时,则可以在模板引擎中注册一个异步函数来获取数据, 仅当模板中用到时再查询数据,相当灵活
然后直接在模板中调用:
The text was updated successfully, but these errors were encountered: