mirror of
https://github.com/kataras/iris.git
synced 2026-01-22 11:25:59 +00:00
Full support of the http.FileSystem on all view engines as requested at #1575
Also, the HandleDir accepts both string and http.FileSystem (interface{}) (like the view's fs)
This commit is contained in:
20
_examples/view/template_amber_0/main.go
Normal file
20
_examples/view/template_amber_0/main.go
Normal file
@@ -0,0 +1,20 @@
|
||||
package main
|
||||
|
||||
import "github.com/kataras/iris/v12"
|
||||
|
||||
func main() {
|
||||
app := iris.New()
|
||||
|
||||
// Read about its markup syntax at: https://github.com/eknkc/amber
|
||||
tmpl := iris.Amber("./views", ".amber")
|
||||
|
||||
app.RegisterView(tmpl)
|
||||
|
||||
app.Get("/", func(ctx iris.Context) {
|
||||
ctx.View("index.amber", iris.Map{
|
||||
"Title": "Title of The Page",
|
||||
})
|
||||
})
|
||||
|
||||
app.Listen(":8080")
|
||||
}
|
||||
11
_examples/view/template_amber_0/views/index.amber
Normal file
11
_examples/view/template_amber_0/views/index.amber
Normal file
@@ -0,0 +1,11 @@
|
||||
extends layouts/main.amber
|
||||
|
||||
block append meta
|
||||
meta[name="keywords"][content="These are added by the child template"]
|
||||
|
||||
block menu
|
||||
li Item 1
|
||||
li Item 2
|
||||
|
||||
block content
|
||||
p Content from child template
|
||||
15
_examples/view/template_amber_0/views/layouts/main.amber
Normal file
15
_examples/view/template_amber_0/views/layouts/main.amber
Normal file
@@ -0,0 +1,15 @@
|
||||
!!! transitional
|
||||
html
|
||||
head
|
||||
title #{Title}
|
||||
|
||||
block meta
|
||||
meta[name="description"][value="This is a sample"]
|
||||
|
||||
body
|
||||
header#mainHeader
|
||||
ul
|
||||
block menu
|
||||
|
||||
div#content
|
||||
block content
|
||||
Reference in New Issue
Block a user