Documentation ¶
Overview ¶
multitemplate is a package that allows multiple templates written in multiple template languages to call between each other. This is the revel connector for multitemplate. See godoc.org/github.com/acsellers/multitemplate/revel for the integration instructions.
Index ¶
- Variables
- func Init(helper string)
- func RefreshPaths(morePaths ...string)
- func RefreshTemplates() error
- type Controller
- func (c *Controller) Block(name string, content template.HTML)
- func (c *Controller) ContentFor(name, templateName string)
- func (c *Controller) Render(extraRenderArgs ...interface{}) revel.Result
- func (c *Controller) RenderTemplate(templateName string) revel.Result
- func (c *Controller) SetLayout(name string)
- type RequestFormat
Constants ¶
This section is empty.
Variables ¶
var ( // DefaultLayout allows you to set a layout that will automatically be added // per content type. DefaultLayout = make(map[RequestFormat]string) // Template is the template loader used by multitemplate. It will be replaced each // time the templates a refreshed if you are using auto-refresh. Template *mt.Template // In DevMode, multitemplate will automatically // refresh templates using revel's Watcher struct, // in ProductionMode, you can change ProdRefresh to // true to get that behavior. Maybe you're doing // something special with FUSE and template folders // so you would need this. RefreshPaths will not start // watching folders in DevMode without this. ProdRefresh bool // CurrentError will record any errors encountered when loading templates, so it // can be displayed when rendering the page. CurrentError error )
var ReloadFilter = func(c *revel.Controller, fc []revel.Filter) { if watch != nil { watch.Notify() } fc[0](c, fc[1:]) }
Functions ¶
func RefreshPaths ¶
func RefreshPaths(morePaths ...string)
If you have added paths for templates beyond the paths accessible in the array revel.TemplatePaths, call this function to pick up those directories autmatically. You can also pass extra paths to this function if you prefer it, and multitemplate will also save and watch those paths.
func RefreshTemplates ¶
func RefreshTemplates() error
RefreshTemplates is automatically called by the auto-refresh system or when you call RefreshPaths.
Types ¶
type Controller ¶
type Controller struct { *revel.Controller // contains filtered or unexported fields }
Controller can be added to your controller structs in your revel app to use the multitemplate system.
func (*Controller) Block ¶
func (c *Controller) Block(name string, content template.HTML)
Block sets a pre-rendered HTML string that can show up in a yield or block.
func (*Controller) ContentFor ¶
func (c *Controller) ContentFor(name, templateName string)
ContentFor sets a template to be rendered for a key, this can be used by either a block call or a yield call.
func (*Controller) Render ¶
func (c *Controller) Render(extraRenderArgs ...interface{}) revel.Result
Standard Render call, this renders the default template for this action.
func (*Controller) RenderTemplate ¶
func (c *Controller) RenderTemplate(templateName string) revel.Result
RenderTemplate renders a specific template by path. If a DefaultLayout value is available for this content type, it will be filled in automatically.
func (*Controller) SetLayout ¶
func (c *Controller) SetLayout(name string)
SetLayout sets the layout to be executed for this action. Set it to the empty string to disable the layout for this action.
type RequestFormat ¶
type RequestFormat string
const ( HTML RequestFormat = "html" XML RequestFormat = "xml" JSON RequestFormat = "json" TXT RequestFormat = "txt" )