mirror of
https://github.com/kataras/iris.git
synced 2026-01-03 02:07:06 +00:00
builtin html template functions changes
This commit is contained in:
@@ -21,9 +21,12 @@ func main() {
|
||||
}
|
||||
|
||||
func index(ctx iris.Context) {
|
||||
ctx.View("program.amber", iris.Map{
|
||||
if err := ctx.View("program.amber", iris.Map{
|
||||
"Name": "Gerasimos",
|
||||
// Or per template:
|
||||
// "greet": func(....)
|
||||
})
|
||||
}); err != nil {
|
||||
ctx.HTML("<h3>%s</h3>", err.Error())
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,7 +21,10 @@ func main() {
|
||||
}
|
||||
|
||||
func index(ctx iris.Context) {
|
||||
ctx.View("program.html", iris.Map{
|
||||
if err := ctx.View("program.html", iris.Map{
|
||||
"Name": "Gerasimos",
|
||||
})
|
||||
}); err != nil {
|
||||
ctx.HTML("<h3>%s</h3>", err.Error())
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,10 @@ func main() {
|
||||
}
|
||||
|
||||
func index(ctx iris.Context) {
|
||||
ctx.View("program.html", iris.Map{
|
||||
if err := ctx.View("program.html", iris.Map{
|
||||
"Name": "Gerasimos",
|
||||
})
|
||||
}); err != nil {
|
||||
ctx.HTML("<h3>%s</h3>", err.Error())
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,7 +27,10 @@ func main() {
|
||||
}
|
||||
|
||||
func index(ctx iris.Context) {
|
||||
ctx.View("program.jet", iris.Map{
|
||||
if err := ctx.View("program.jet", iris.Map{
|
||||
"Name": "Gerasimos",
|
||||
})
|
||||
}); err != nil {
|
||||
ctx.HTML("<h3>%s</h3>", err.Error())
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,9 +31,12 @@ func main() {
|
||||
}
|
||||
|
||||
func index(ctx iris.Context) {
|
||||
ctx.View("program.html", iris.Map{
|
||||
if err := ctx.View("program.html", iris.Map{
|
||||
"Name": "Gerasimos",
|
||||
})
|
||||
}); err != nil {
|
||||
ctx.HTML("<h3>%s</h3>", err.Error())
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
func layout(ctx iris.Context) {
|
||||
|
||||
@@ -6,6 +6,6 @@
|
||||
<body>
|
||||
<h1>[layout] Body content is below...</h1>
|
||||
<!-- Render the current template here -->
|
||||
{{ yield }}
|
||||
{{ yield . }}
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user