Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
张磊
/
FileStorageBeego
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
b6f06a55
authored
2013-04-21 11:28:20 +0800
by
astaxie
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
add template can't find template file
1 parent
0172c6c1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
0 deletions
controller.go
controller.go
View file @
b6f06a5
...
...
@@ -6,6 +6,7 @@ import (
"compress/zlib"
"encoding/json"
"encoding/xml"
"errors"
"github.com/astaxie/beego/session"
"html/template"
"io"
...
...
@@ -148,6 +149,10 @@ func (c *Controller) RenderBytes() ([]byte, error) {
subdir
:=
path
.
Dir
(
c
.
TplNames
)
_
,
file
:=
path
.
Split
(
c
.
TplNames
)
newbytes
:=
bytes
.
NewBufferString
(
""
)
if
_
,
ok
:=
BeeTemplates
[
subdir
];
!
ok
{
panic
(
"can't find templatefile in the path:"
+
c
.
TplNames
)
return
[]
byte
{},
errors
.
New
(
"can't find templatefile in the path:"
+
c
.
TplNames
)
}
BeeTemplates
[
subdir
]
.
ExecuteTemplate
(
newbytes
,
file
,
c
.
Data
)
tplcontent
,
_
:=
ioutil
.
ReadAll
(
newbytes
)
c
.
Data
[
"LayoutContent"
]
=
template
.
HTML
(
string
(
tplcontent
))
...
...
@@ -169,6 +174,10 @@ func (c *Controller) RenderBytes() ([]byte, error) {
subdir
:=
path
.
Dir
(
c
.
TplNames
)
_
,
file
:=
path
.
Split
(
c
.
TplNames
)
ibytes
:=
bytes
.
NewBufferString
(
""
)
if
_
,
ok
:=
BeeTemplates
[
subdir
];
!
ok
{
panic
(
"can't find templatefile in the path:"
+
c
.
TplNames
)
return
[]
byte
{},
errors
.
New
(
"can't find templatefile in the path:"
+
c
.
TplNames
)
}
err
:=
BeeTemplates
[
subdir
]
.
ExecuteTemplate
(
ibytes
,
file
,
c
.
Data
)
if
err
!=
nil
{
Trace
(
"template Execute err:"
,
err
)
...
...
Write
Preview
Styling with
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment