【发布时间】:2016-08-02 17:02:26
【问题描述】:
我想用 n2o 和 rebar3 写网页。 但是我的页面有问题,代码在这里。
index.erl
-module(index).
-compile(export_all).
-include_lib("n2o/include/wf.hrl").
-include_lib("nitro/include/nitro.hrl").
main() -> #dtl{file="prod",app=web, ext="dtl", bindings=[{body,body()} ]}.
body() ->
[ #span { id=display }, #br{},
#span { body="Login: " }, #textbox{id=user,autofocus=true}, #br{},
#span { body="Join/Create Feed: " }, #textbox{id=pass},
#button { id=loginButton, body="Login",postback=login,source=[user,pass]} ].
prod.dtl
<html >
<head>
<title>{{title}}</title>
</head>
<body>
{{body}}
</body>
</html>
我得到了结果:
<html >
<head>
<title></title>
</head>
<body>
<span id="display"></span><br/><span>Login: </span><input id="user" type="text" autofocus="true"/><br/><span>Join/Create Feed: </span><input id="pass" type="text"/><button id="loginButton" type="button">Login</button>
</body>
</html>
我怎样才能得到'
【问题讨论】:
-
在
prod.etl中将{{body}}更改为{{body | safe}}是否有效? -
您使用的是哪个版本的 DTL? N2O 最高支持 0.8。更新版本由您决定。
-
@Dogbert 它的工作....谢谢
-
@Dogbert 谢谢,这对我来说是新的 :-)
-
@5HT 我使用 rebar3_erlydtl_plugin 。它使用最新版本的 erlydtl .so...