示例#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
文件: 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"
}
示例#4
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"
}