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" }
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" }
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" }
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" }
// (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" }