1
0
mirror of https://github.com/kataras/iris.git synced 2025-12-23 12:57:05 +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

@@ -37,10 +37,16 @@ func main() {
my := app.Party("/my").Layout("layouts/mylayout.html")
{ // both of these will use the layouts/mylayout.html as their layout.
my.Get("/", func(ctx iris.Context) {
ctx.View("page1.html")
if err := ctx.View("page1.html"); err != nil {
ctx.HTML("<h3>%s</h3>", err.Error())
return
}
})
my.Get("/other", func(ctx iris.Context) {
ctx.View("page1.html")
if err := ctx.View("page1.html"); err != nil {
ctx.HTML("<h3>%s</h3>", err.Error())
return
}
})
}

View File

@@ -7,6 +7,6 @@
<h1>This is the global layout</h1>
<br />
<!-- Render the current template here -->
{{ yield }}
{{ yield . }}
</body>
</html>

View File

@@ -7,6 +7,6 @@
<h1>This is the layout for the /my/ and /my/other routes only</h1>
<br />
<!-- Render the current template here -->
{{ yield }}
{{ yield . }}
</body>
</html>

View File

@@ -2,6 +2,6 @@
<h1>Page 1 {{ greet "iris developer"}}</h1>
{{ render "partials/page1_partial1.html"}}
{{ render "partials/page1_partial1.html" . }}
</div>