Exemple #1
0
func (c Copyfrom) Index(copyfrom *models.Copyfrom) revel.Result {
	title := "来源管理--GoCMS管理系统"

	var page string = c.Params.Get("page")

	//判断是否是系统的分隔符
	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")

	if len(page) > 0 {
		Page, err := strconv.ParseInt(page, 10, 64)
		if err != nil {
			revel.WARN.Println(err)
		}

		copyfrom_list, pages := copyfrom.GetByAll(Page, 10)

		c.Render(title, copyfrom_list, sitedomain, pages)
	} else {
		copyfrom_list, pages := copyfrom.GetByAll(1, 10)

		c.Render(title, copyfrom_list, sitedomain, pages)
	}

	return c.RenderTemplate("Extend/Copyfrom/Index.html")
}