Skip to content

A tiny little helper for using Pongo2 (v3) with Beego.

License

Notifications You must be signed in to change notification settings

Michael2008S/beego-pongo2.v3

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

beego-pongo2.v3

A tiny little helper for using Pongo2 (v3) with Beego.

Status: With little tests. IF YOU FIND BUGS, PLS LET ME KNOW.

Documentation: http://godoc.org/github.com/danegigi/beego-pongo2.v3

Based on https://github.com/ipfans/beego-pongo2.v2

Usage

package controllers

import (
    "github.com/astaxie/beego"
    "github.com/danegigi/beego-pongo2.v3"
)

type MainController struct {
    beego.Controller
}

func (this *MainController) Page1() {
    err := pongo2.Render(this.Ctx, "page.html", pongo2.Context{
        "ints": []int{1, 2, 3, 4, 5},
    })

    if err != nil{
      this.Abort("500")
    }
}

func (this *MainController) Page2(){
  str, err := pongo2.RenderString("page2.html", pongo2.Context{
    "name": "My Name"
  })

  if err != nil{
    this.Abort("500")
  }

  this.Ctx.WriteString(str)
}

About

A tiny little helper for using Pongo2 (v3) with Beego.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages