venjiang / mons

go cms

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

mons

Install

  • go get github.com/go-martini/martini

  • go get github.com/martini-contrib/render

  • go get github.com/martini-contrib/binding

  • go get github.com/martini-contrib/sessions

  • go get github.com/martini-contrib/sessionauth

  • go get github.com/coopernurse/gorp

  • go get github.com/lib/pq

  • go get github.com/Unknwon/goconfig

Run

  • GIN实时编译
    • go get github.com/codegangsta/gin (%GOPATH%/bin下会自动加入gin)
    • cd path/mons
    • gin -a 8080
  • GOM 包管理
    • go get -u github.com/mattn/gom
    • gom gen gomfile
    • gom install [options] : Install bundled packages into _vendor
    • gom build [options] : Build with _vendor packages directory, by default.
    • gom run server.go

扩展功能

  • 内部函数调用
    • 站点信息 {{call .mons.site}}
    • 导航菜单 {{call .mons.menu}}
  • 添加自定义函数
    1. 在中间件或控制器,书写: context.Funcs["fname"] = func(m ...interface{}) (interface{},error),内部函数建议用小写名称,返回值最多两个,如果两个,第二个参数为error
    2. 调用: {{call .funcs.fname 参数...}}

About

go cms

License:GNU General Public License v2.0


Languages

Language:JavaScript 65.1%Language:CSS 32.6%Language:Go 2.3%