1
0
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:
Gerasimos (Makis) Maropoulos
2022-12-13 01:37:15 +02:00
parent abeae40e60
commit 1ea5cd58be
115 changed files with 472 additions and 230 deletions

View File

@@ -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
}
}

View File

@@ -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
}
}

View File

@@ -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
}
}

View File

@@ -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
}
}

View File

@@ -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) {

View File

@@ -6,6 +6,6 @@
<body>
<h1>[layout] Body content is below...</h1>
<!-- Render the current template here -->
{{ yield }}
{{ yield . }}
</body>
</html>