mirror of
https://github.com/kataras/iris.git
synced 2025-12-27 14:57:05 +00:00
builtin html template functions changes
This commit is contained in:
@@ -37,7 +37,10 @@ func index(ctx iris.Context) {
|
||||
}
|
||||
|
||||
ctx.ViewLayout("main")
|
||||
ctx.View("index", data)
|
||||
if err := ctx.View("index", data); err != nil {
|
||||
ctx.HTML("<h3>%s</h3>", err.Error())
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
func admin(ctx iris.Context) {
|
||||
@@ -46,7 +49,10 @@ func admin(ctx iris.Context) {
|
||||
}
|
||||
|
||||
ctx.ViewLayout("main")
|
||||
ctx.View("index", data)
|
||||
if err := ctx.View("index", data); err != nil {
|
||||
ctx.HTML("<h3>%s</h3>", err.Error())
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
func setViews(views iris.ViewEngine) iris.Handler {
|
||||
@@ -61,5 +67,8 @@ func onFly(ctx iris.Context) {
|
||||
"Message": "View engine changed through 'setViews' custom middleware.",
|
||||
}
|
||||
|
||||
ctx.View("index", data)
|
||||
if err := ctx.View("index", data); err != nil {
|
||||
ctx.HTML("<h3>%s</h3>", err.Error())
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,6 +8,6 @@
|
||||
<body>
|
||||
{{ template "content" . }}
|
||||
|
||||
<footer>{{ partial "partials/footer" .}}</footer>
|
||||
<footer>{{ partial "partials/footer" . }}</footer>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user