本文整理匯總了Golang中github.com/blackmady/NoneCMS/app/models.Article.Thumb方法的典型用法代碼示例。如果您正苦於以下問題:Golang Article.Thumb方法的具體用法?Golang Article.Thumb怎麽用?Golang Article.Thumb使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/blackmady/NoneCMS/app/models.Article
的用法示例。
在下文中一共展示了Article.Thumb方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: Edit
//編輯內容
func (c Content) Edit(article *models.Article) revel.Result {
if c.Request.Method == "GET" {
title := "內容--GoCMS編輯內容"
var cid string = c.Params.Get("cid")
var id string = c.Params.Get("id")
if len(cid) > 0 {
Cid, err := strconv.ParseInt(cid, 10, 64)
if err != nil {
revel.WARN.Println(err)
}
Id, err := strconv.ParseInt(id, 10, 64)
if err != nil {
revel.WARN.Println(err)
}
//內容
article_info := article.GetById(Id)
//欄目信息
category := new(models.Category)
category_info := category.GetById(Cid)
//來源
copyfrom := new(models.Copyfrom)
copyfrom_list := copyfrom.GetRoleList()
c.Render(title, cid, category_info, article_info, copyfrom_list)
return c.RenderTemplate("Content/Manage/Edit.html")
} else {
c.Render(title, cid)
return c.RenderTemplate("Content/Manage/Edit.html")
}
} else {
var dosubmit string = c.Params.Get("dosubmit")
var dosubmit_continue string = c.Params.Get("dosubmit_continue")
var cid string = c.Params.Get("cid")
var id string = c.Params.Get("id")
Id, err := strconv.ParseInt(id, 10, 64)
if err != nil {
revel.WARN.Println(err)
}
var title string = c.Params.Get("title")
if len(title) > 0 {
article.Title = title
} else {
c.Flash.Error("請輸入標題!")
c.Flash.Out["url"] = "/Content/Add/" + cid + "/"
return c.Redirect("/Message/")
}
var style_color string = c.Params.Get("style_color")
article.Color = style_color
var style_font_weight string = c.Params.Get("style_font_weight")
article.Font = style_font_weight
var thumb string = c.Params.Get("thumb")
if len(thumb) > 0 {
//判斷是否是係統的分隔符
separator := "/"
if os.IsPathSeparator('\\') {
separator = "\\"
} else {
separator = "/"
}
config_file := (revel.BasePath + "/conf/config.conf")
config_file = strings.Replace(config_file, "/", separator, -1)
config_conf, _ := config.ReadDefault(config_file)
//前台網站地址
sitedomain, _ := config_conf.String("website", "website.sitedomain")
thumb = strings.Replace(thumb, sitedomain, "", -1)
article.Thumb = thumb
} else {
article.Thumb = ""
}
var content string = c.Params.Get("content")
if len(content) > 0 {
article.Content = content
} else {
c.Flash.Error("請輸入內容!")
c.Flash.Out["url"] = "/Content/Add/" + cid + "/"
return c.Redirect("/Message/")
}
var copyfrom string = c.Params.Get("copyfrom")
//.........這裏部分代碼省略.........