diff --git a/geg/os/gview/layout/layout1/main.go b/geg/os/gview/layout/layout1/main.go new file mode 100644 index 000000000..c64276d63 --- /dev/null +++ b/geg/os/gview/layout/layout1/main.go @@ -0,0 +1,15 @@ +package main + +import ( + "github.com/gogf/gf/g" + "github.com/gogf/gf/g/net/ghttp" +) + +func main() { + s := g.Server() + s.BindHandler("/", func(r *ghttp.Request) { + r.Response.WriteTpl("layout.html", nil) + }) + s.SetPort(8199) + s.Run() +} diff --git a/geg/os/gview/layout/layout1/template/container.html b/geg/os/gview/layout/layout1/template/container.html new file mode 100644 index 000000000..5902716a8 --- /dev/null +++ b/geg/os/gview/layout/layout1/template/container.html @@ -0,0 +1,3 @@ +{{define "container"}} +

CONTAINER

+{{end}} \ No newline at end of file diff --git a/geg/os/gview/layout/layout1/template/footer.html b/geg/os/gview/layout/layout1/template/footer.html new file mode 100644 index 000000000..782a3c05f --- /dev/null +++ b/geg/os/gview/layout/layout1/template/footer.html @@ -0,0 +1,3 @@ +{{define "footer"}} +

FOOTER

+{{end}} \ No newline at end of file diff --git a/geg/os/gview/layout/layout1/template/header.html b/geg/os/gview/layout/layout1/template/header.html new file mode 100644 index 000000000..7e2c837c4 --- /dev/null +++ b/geg/os/gview/layout/layout1/template/header.html @@ -0,0 +1,3 @@ +{{define "header"}} +

HEADER

+{{end}} \ No newline at end of file diff --git a/geg/os/gview/layout/layout1/template/layout.html b/geg/os/gview/layout/layout1/template/layout.html new file mode 100644 index 000000000..8c117123a --- /dev/null +++ b/geg/os/gview/layout/layout1/template/layout.html @@ -0,0 +1,15 @@ + + + + GoFrame Layout + {{template "header"}} + + +
+ {{template "container"}} +
+ + + \ No newline at end of file diff --git a/geg/os/gview/layout/layout2/main.go b/geg/os/gview/layout/layout2/main.go new file mode 100644 index 000000000..f1187af19 --- /dev/null +++ b/geg/os/gview/layout/layout2/main.go @@ -0,0 +1,23 @@ +package main + +import ( + "github.com/gogf/gf/g" + "github.com/gogf/gf/g/net/ghttp" +) + +func main() { + s := g.Server() + s.BindHandler("/main1", func(r *ghttp.Request) { + r.Response.WriteTpl("layout.html", g.Map{ + "mainTpl": "main/main1.html", + }) + }) + s.BindHandler("/main2", func(r *ghttp.Request) { + r.Response.WriteTpl("layout.html", g.Map{ + "mainTpl": "main/main2.html", + }) + }) + g.View().SetPath("template") + s.SetPort(8199) + s.Run() +} diff --git a/geg/os/gview/layout/layout2/template/footer.html b/geg/os/gview/layout/layout2/template/footer.html new file mode 100644 index 000000000..83ae25b65 --- /dev/null +++ b/geg/os/gview/layout/layout2/template/footer.html @@ -0,0 +1 @@ +

FOOTER

\ No newline at end of file diff --git a/geg/os/gview/layout/layout2/template/header.html b/geg/os/gview/layout/layout2/template/header.html new file mode 100644 index 000000000..b9cb0a77c --- /dev/null +++ b/geg/os/gview/layout/layout2/template/header.html @@ -0,0 +1 @@ +

HEADER

\ No newline at end of file diff --git a/geg/os/gview/layout/layout2/template/layout.html b/geg/os/gview/layout/layout2/template/layout.html new file mode 100644 index 000000000..9f58c21a0 --- /dev/null +++ b/geg/os/gview/layout/layout2/template/layout.html @@ -0,0 +1,3 @@ +{{include "header.html" .}} +{{include .mainTpl .}} +{{include "footer.html" .}} \ No newline at end of file diff --git a/geg/os/gview/layout/layout2/template/main/main1.html b/geg/os/gview/layout/layout2/template/main/main1.html new file mode 100644 index 000000000..fdb0016f3 --- /dev/null +++ b/geg/os/gview/layout/layout2/template/main/main1.html @@ -0,0 +1 @@ +

MAIN1

\ No newline at end of file diff --git a/geg/os/gview/layout/layout2/template/main/main2.html b/geg/os/gview/layout/layout2/template/main/main2.html new file mode 100644 index 000000000..608512269 --- /dev/null +++ b/geg/os/gview/layout/layout2/template/main/main2.html @@ -0,0 +1 @@ +

MAIN2

\ No newline at end of file