func (this *HomeController) SinglePost() { this.TplNames = "home.html" reqPath := this.Ctx.Request.RequestURI[1:] if strings.HasSuffix(reqPath, ".jpg") || strings.HasSuffix(reqPath, ".png") || strings.HasSuffix(reqPath, ".gif") { f, err := os.Open(path.Join("content", reqPath)) if err != nil { beego.Error(err) return } defer f.Close() io.Copy(this.Ctx.ResponseWriter, f) return } this.Data["IsSinglePost"] = true this.Data["RecentList"] = models.GetRecentPosts(10) arch := models.GetSinglePost(this.Ctx.Request.RequestURI[1:]) if arch == nil { this.Redirect("/", 302) return } this.Data["SinglePost"] = arch }
func (this *WorkController) SingleWork() { this.TplNames = "home.html" this.Data["IsWork"] = true this.Data["IsSingleWork"] = true this.Data["RecentList"] = models.GetRecentPosts(10) work := models.GetSingleWork(this.Ctx.Request.RequestURI[6:]) if work == nil { this.Redirect("/", 302) return } this.Data["SingleWork"] = work }
func (this *WorkController) Get() { this.Data["IsWork"] = true this.TplNames = "home.html" this.Data["AllWorks"] = models.GetAllWorks() this.Data["RecentList"] = models.GetRecentPosts(10) }
func (this *RecommendController) Blogs() { this.TplNames = "blogs.html" this.Data["Blogs"] = models.GetBlogs() this.Data["RecentList"] = models.GetRecentPosts(10) }
func (this *HomeController) Archives() { this.TplNames = "home.html" this.Data["IsAllPost"] = true this.Data["RecentArchives"] = models.GetAllPosts() this.Data["RecentList"] = models.GetRecentPosts(10) }
func (this *HomeController) Get() { this.Data["IsHome"] = true this.TplNames = "home.html" this.Data["RecentArchives"] = models.GetRecentPosts(15) this.Data["RecentList"] = models.GetRecentPosts(15) }