1

我想将索引页面分成小的独立 .html 部分,例如:

up_bar.html:
<p><center> <h1>home</h1> Menu: <a href="/">home</a> <a href="add">add</a> <a href="/import">import</a>

down_bar.html:
<a href="/path/.."/>
等等。现在,要构建一个新页面,是否可以使用默认的 webpy 模板

将这些部分嵌入到其他页面中?

也许是这样的?:
在 admin.html 中:
$def with(some_parameters):
<title>Admin panel</title>
$include('side_bar.html')
... body stuff ...
$include('down_bar.html')

4

3 回答 3

1

可以在这里找到关于模板继承的基本但很好的介绍:http ://webpy.org/cookbook/layout_template

于 2011-04-20T17:36:45.477 回答
0

在这里找到了答案:
http ://groups.google.com/group/webpy/msg/ea6da02dfb9eedc4?dmode=source
一些解释会很好。

于 2011-04-01T12:17:16.593 回答
0

我对我的代码做了这个

def GET(self,*args):
    param= {'name':'jackie'}
    view = web.template.frender("views/someview.html")
    content = view(**param)
    layout = web.template.frender("views/index.html")
    return layout(content=content)

$:content现在你只需插入index.html

于 2015-04-01T02:39:04.200 回答