improving gview with ghttp for controller

This commit is contained in:
John
2019-09-09 23:02:40 +08:00
parent 7f943c6b5f
commit 09da0f7388
4 changed files with 7 additions and 10 deletions

View File

@ -1 +1,2 @@
<h1>MAIN1</h1>
<h1>MAIN1</h1>
<h1>Name: {{.name}}</h1>

View File

@ -1 +1,2 @@
<h1>MAIN2</h1>
<h1>MAIN2</h1>
<h1>Name: {{.name}}</h1>

View File

@ -10,11 +10,8 @@ type Controller struct {
}
func (c *Controller) Index() {
c.View.Display("layout.html")
}
// 不符合规范,不会被自动注册
func (c *Controller) Test(value interface{}) {
c.View.Assign("name", "john")
c.View.Assign("mainTpl", "main/main2.html")
c.View.Display("layout.html")
}