26
2019.2
show方法
作者: POPASP
that.display与that.show两者都可以进行模板输出,但是二者稍有不同。
that.show没有参数,它等价于`that.display("")`。我们在模板输出时如果控制器的方法名与模板名对应一致,我们就可以使用that.show进行模板输出。
比如,控制器Controller/Index.asp文件
```brush:vb
<%
Class Index
sub cache
dim id
id = POP_MVC.get("id")
if not that.isCached( array( "" , id ) ) then
that.d("cacheTime") = now()
end if
that.show
end sub
End Class
%>
```
如果使用了that.show,那么就要求在`Tpl/Index/`下面有一个"cache.html"文件,而且渲染的也是这个文件。