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.
我想根据页面更改布局设计。那么我能否获得基本上会提供有关加载页面的信息的值。喜欢
{{is_mobile=request.user_agent().is_mobile}}
我想用
{{if request.page =='page1'}}
在 web2py 中的 layout.html 中
控制器名称是 in request.controller,函数名称是 in request.function(您将需要这两个名称来唯一标识特定的“页面”)。您也可以使用response.view,它通常包括控制器和函数(例如,“default/index.html”)。
request.controller
request.function
response.view