示例#1
0
文件: index.go 项目: ckeyer/goblog
func (c *IndexController) Get() {
	page, _ := c.GetInt("page")
	step := 15

	c.Data["Blogs"] = models.GetBlogs(page*step, (page+1)*step)
	c.Data["LastestBlogs"] = models.GetBlogs(0, 5)
	c.Data["Tags"] = models.GetAllTags()
	c.Data["Category"] = models.GetAllCategory()
	c.Data["MonthBlog"] = models.GetAllMonth()

	c.LayoutSections["Sidebar"] = "sidebar.tpl"

	c.TplName = "list.tpl"
}
示例#2
0
文件: tag.go 项目: ckeyer/goblog
func (c *TagController) Get() {
	name := c.GetString("t")

	if tg := models.GetBlogsByTag(name); tg != nil {
		c.Data["Blogs"] = tg
	} else {
		log.Errorf("Tag Errer %s", name)
		c.Data["Blogs"] = models.GetBlogs(0, 10)
	}

	c.Data["LastestBlogs"] = models.GetBlogs(0, 5)
	c.Data["Tags"] = models.GetAllTags()
	c.Data["Category"] = models.GetAllCategory()
	c.Data["MonthBlog"] = models.GetAllMonth()

	c.LayoutSections["Sidebar"] = "sidebar.tpl"

	c.TplName = "list.tpl"
}
示例#3
0
文件: archive.go 项目: ckeyer/goblog
func (c *ArchiveController) Get() {
	year := c.Ctx.Input.Param(":year")
	month := c.Ctx.Input.Param(":month")
	name := year + "-" + month
	log.Debug("Archive name: ", name)
	if tg := models.GetBlogsByMonth(name); tg != nil {
		c.Data["Blogs"] = tg
	} else {
		log.Errorf("Tag Errer %s", name)
		c.Data["Blogs"] = models.GetBlogs(0, 10)
	}

	c.Data["LastestBlogs"] = models.GetBlogs(0, 5)
	c.Data["Tags"] = models.GetAllTags()
	c.Data["Category"] = models.GetAllCategory()
	c.Data["MonthBlog"] = models.GetAllMonth()

	c.LayoutSections["Sidebar"] = "sidebar.tpl"

	c.TplName = "list.tpl"
}
示例#4
0
func (m *MainController) Get() {
	m.AddKeyWord("极客", "个人博客")

	m.AddCustomCssStyle(website.CssUrl+"2048/", "main.css")
	m.AddCustomJsScript(website.JsUrl+"2048/", "bind_polyfill.js", "classlist_polyfill.js", "animframe_polyfill.js",
		"keyboard_input_manager.js", "html_actuator.js", "grid.js", "tile.js",
		"local_storage_manager.js", "game_manager.js", "application.js")

	m.Data["LatestBlogs"] = models.GetBlogs(0, 5)

	m.TplNames = "index.tpl"
}
示例#5
0
文件: blog.go 项目: ckeyer/goblog
// (b *BaseController)GetBlogs ...
func (b *BlogController) Get() {
	b.Data["LastestBlogs"] = models.GetBlogs(0, 5)
	b.Data["Tags"] = models.GetAllTags()
	b.Data["Category"] = models.GetAllCategory()
	b.Data["MonthBlog"] = models.GetAllMonth()

	name := b.Ctx.Input.Param(":name")
	blog := models.GetBlog(name)
	if blog == nil {
		log.Debug("name: ", name)
		return
	}
	b.Data["Blog"] = blog
	b.Data["BContent"] = string(blog.Content)

	b.LayoutSections["Sidebar"] = "sidebar.tpl"
	b.LayoutSections["Duoshuo"] = "duoshuo.tpl"
	b.TplName = "show.tpl"
}