简体   繁体   English

Web2py:如何配置menu.py以添加指向外部链接的链接

[英]Web2py: how to config menu.py to add link to an external link

I have just started learning the web2py framework from example, I saw that when the menu.py is configured as following: 我刚从示例开始学习web2py框架,我看到当menu.py配置如下:

response.menu = [
    (T('Index'), False, URL('default','index'),[]),]

Then there will be an item show in the menu bar, linking to: 然后菜单栏中会显示一个项目,链接到:

%website%/%application name%/default/index %website%/%应用程序名称%/ default / index

So here is the question, how to config the menu.py file so as to add an item to link to an external link? 所以这里有一个问题,如何配置menu.py文件,以便添加一个项链接到外部链接? Say: www.google.com 说:www.google.com

The third item in the tuple can be any URL, not just one generated by the web2py URL() function. 元组中的第三项可以是任何URL,而不仅仅是web2py URL()函数生成的URL() So, you can do: 所以,你可以这样做:

response.menu = [(T('Index'), False, 'http://www.google.com')]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM