mirror of
https://github.com/astaxie/beego.git
synced 2024-11-26 03:01:28 +00:00
Add template prefix field to controller
This commit is contained in:
parent
88c5dfa6ea
commit
fee06a23bd
@ -71,6 +71,7 @@ type Controller struct {
|
|||||||
TplName string
|
TplName string
|
||||||
Layout string
|
Layout string
|
||||||
LayoutSections map[string]string // the key is the section name and the value is the template name
|
LayoutSections map[string]string // the key is the section name and the value is the template name
|
||||||
|
TplPrefix string
|
||||||
TplExt string
|
TplExt string
|
||||||
EnableRender bool
|
EnableRender bool
|
||||||
|
|
||||||
@ -226,6 +227,9 @@ func (c *Controller) renderTemplate() (bytes.Buffer, error) {
|
|||||||
var buf bytes.Buffer
|
var buf bytes.Buffer
|
||||||
if c.TplName == "" {
|
if c.TplName == "" {
|
||||||
c.TplName = strings.ToLower(c.controllerName) + "/" + strings.ToLower(c.actionName) + "." + c.TplExt
|
c.TplName = strings.ToLower(c.controllerName) + "/" + strings.ToLower(c.actionName) + "." + c.TplExt
|
||||||
|
if c.TplPrefix != "" {
|
||||||
|
c.TplName = c.TplPrefix + c.TplName
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if BConfig.RunMode == DEV {
|
if BConfig.RunMode == DEV {
|
||||||
buildFiles := []string{c.TplName}
|
buildFiles := []string{c.TplName}
|
||||||
|
Loading…
Reference in New Issue
Block a user