示例#1
0
// Get implemented Get method for FuncsRouter.
func (this *FuncsRouter) Get() {
	this.Data["IsFuncs"] = true
	this.TplNames = "funcs.html"

	// Get argument(s).
	q := strings.TrimSpace(this.Input().Get("q"))

	// Set properties.
	this.Data["Keyword"] = q

	if len(q) > 0 {
		// Function search.
		pfuncs := models.SearchFunc(q)

		// Show results after searched.
		if len(pfuncs) > 0 {
			this.Data["IsFindFunc"] = true
			this.Data["Results"] = pfuncs
		}
	} else {
		this.Data["IsShowIntro"] = true
	}
}
示例#2
0
文件: funcs.go 项目: JoeyFan/gowalker
// Get implemented Get method for FuncsRouter.
func (this *FuncsRouter) Get() {
	// Set language version.
	curLang := globalSetting(this.Ctx, this.Input(), this.Data)

	// Get argument(s).
	q := strings.TrimSpace(this.Input().Get("q"))

	// Set properties.
	this.TplNames = "funcs_" + curLang.Lang + ".html"
	this.Data["Keyword"] = q

	if len(q) > 0 {
		// Function search.
		pfuncs := models.SearchFunc(q)

		// Show results after searched.
		if len(pfuncs) > 0 {
			this.Data["IsFindFunc"] = true
			this.Data["Results"] = pfuncs
		}
	} else {
		this.Data["IsShowIntro"] = true
	}
}