瀏覽代碼

Merge branch 'master' of http://192.168.3.207:10080/BP/common into master

zhangxinlei1996 4 年之前
父節點
當前提交
4f458faa78
共有 2 個文件被更改,包括 4 次插入1 次删除
  1. 1 1
      src/github.com/go-xweb/xweb/action.go
  2. 3 0
      src/github.com/go-xweb/xweb/template.go

+ 1 - 1
src/github.com/go-xweb/xweb/action.go

@@ -709,7 +709,7 @@ func (c *Action) Render(tmpl string, params ...*T) error {
 }
 
 //仅生成网页内容
-var regInclude = regexp.MustCompile(`\{\{\s*include\s*"(.*?\.html)"\}\}`)
+var regInclude = regexp.MustCompile(`\{\{\s*include\s*"(.*?\.html)".*\}\}`)
 
 func (c *Action) NamedRender4Cache(name, content string, params ...*T) ([]byte, error) {
 	c.f["oinclude"] = c.Include

+ 3 - 0
src/github.com/go-xweb/xweb/template.go

@@ -365,6 +365,9 @@ func newIncludeIntmpl(rootDir string, content []byte) []byte {
 			b = true
 			tpl := regInclude.FindSubmatch(m)[1]
 			fpath := filepath.Join(rootDir, string(tpl))
+			if strings.Contains(string(m), "OUTSIDE") {
+				fpath = string(tpl)
+			}
 			c, err := ioutil.ReadFile(fpath)
 			if err != nil {
 				return []byte{}