echopongo2

package module
v0.0.0-...-5801426 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 21, 2017 License: MIT Imports: 8 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

echo-pongo2

Use pongo2 templates in the echo web framework

Usage

echo-pongo2 implements the echo Renderer interface

e := echo.New()
r, err := echo-pongo2.NewRenderer("./template")
e.SetRenderer(r)

somewhere in a handler

func Hello(c *echo.Context) error {
    data := map[string]string{"World":"mayowa"}
    return c.Render(http.StatusOK, "hello.html", data)
}

template: ./template/hello.html

Hello {{World}}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Renderer

type Renderer struct {
	BaseDir   string
	DebugMode bool
	TplSet    *pongo2.TemplateSet
}

Renderer manages a pongo2 TemplateSet

func NewRenderer

func NewRenderer(baseDir string, Debug bool) (*Renderer, error)

NewRenderer creates a new instance of Renderer

func (*Renderer) Render

func (r *Renderer) Render(w io.Writer, name string, data interface{}, c echo.Context) error

Render implements echo.Render interface

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL