【问题标题】:How can I pass multiple variables into a template in Webpy?如何将多个变量传递到 Webpy 中的模板中?
【发布时间】:2015-06-21 15:11:53
【问题描述】:

我想将三个不同的变量传递到我使用 Web.py 的 html 模板中。

这是我所拥有的:

class mainScreen:
    def __init__(self):
        self.render=web.template.render('templates/')
    def GET(self):
        return self.render.firstScreen(variable1, variable2, variable3)
    def POST(self):
        pass

在我的 html 模板中:

$def with (variable1)
$def with (variable2)
$def with (variable3)
<!DOCTYPE html>
<html>
<head>
    <title>variable1</title>
</head>
    <body>
        $variable2
        <h1>$variable3</h1>
    </body>
</html>

但是,在我的 html 模板中,我在使用三个变量中的每一个定义的顶部遇到了一个语法错误。如何正确传入三个变量?

【问题讨论】:

    标签: python html web.py


    【解决方案1】:

    使用喜欢

    $def with(product, release, p0,p1,p2,p3, viewby, fromTime, toTime, errormsg, imgurl)
    

    【讨论】:

      猜你喜欢
      • 2012-09-27
      • 1970-01-01
      • 2020-06-23
      • 2018-01-30
      • 1970-01-01
      • 2020-09-15
      • 2010-12-17
      • 1970-01-01
      • 2016-10-04
      相关资源
      最近更新 更多