index
inc/config
inc/config.bak
inc/wts
inc/class/cache
inc/class/cookie
inc/class/db
inc/class/error
inc/class/fso
inc/class/function
inc/class/js
inc/class/load
inc/class/log
inc/class/pagelist
inc/class/request
inc/class/response
inc/class/route
inc/class/session
inc/class/template
inc/class/valid
inc/class/crypt/a2u
inc/class/crypt/aes
inc/class/crypt/base64
inc/class/crypt/des
inc/class/crypt/escape
inc/class/crypt/hex
inc/class/crypt/md5
inc/class/crypt/num
inc/class/crypt/rsa
inc/class/crypt/sha
inc/class/ext/array
inc/class/ext/cart
inc/class/ext/date
inc/class/ext/http
inc/class/ext/jmail
inc/class/ext/jpeg
inc/class/ext/json
inc/class/ext/jsont
inc/class/ext/mail
inc/class/ext/md5
inc/class/ext/pack
inc/class/ext/stringbuilder
inc/class/ext/tqqwry
inc/class/ext/upfile
inc/class/ext/verify
inc/class/ext/webstat
inc/class/ext/wia
inc/class/ext/xml
inc/class/ext/zip
inc/class/route/module
inc/class/route/slash
inc/module/default/control/clear
inc/module/default/control/crypt
inc/module/default/control/error
inc/module/default/control/hello <--
inc/module/default/control/index
inc/module/default/control/json
inc/module/default/control/pic
inc/module/default/control/upload
inc/module/default/control/start/site
inc/module/default/control/start/route/key
inc/module/default/control/start/route/pic
inc/module/default/control/start/route/reg
inc/module/default/control/tag/hello
inc/module/default/language/cn/hello
inc/module/default/language/en/hello
inc/module/default/model/hello
inc/module/help/control/error
inc/module/help/control/index
inc/module/help/control/install
inc/module/help/control/start/site

类描述

title Control_Hello
author ekede.com
date 2018-06-09
description Hello WTS

类方法

Index_Action() 控制器内部转向
List_Action() 查 列表,翻页
Detail_Action() 查 详情
Add_Action() 增 表单
AddSave_Action() 增 保存
Edit_Action() 改 表单
EditSave_Action() 改 保存
Del_Action()

返回

列表分页演示
        '接收参数
        page = wts.valid.IntNum(wts.requests.querystr("page"), 1, 500, "")
		
		'调用模型
        Set mHello = loader.LoadModel("Hello")
        Set rs = mHello.GetAll() '获取数据集合
        Set oPage = loader.LoadClass("PageList") '调用分页对象
        oPage.tempdata = wts.site.tempdata '用全局临时数据存储器取代默认临时数据存储器
        oPage.CurrentPage = page '设置当前页
        oPage.MaxPerPage = 5 '设置每页显示条数
        n = oPage.List("news", rs) '将数据集合导入分页对象,并返回当前页集合条数
        If n = 0 Then
            wts.errs.AddMsg "no page"
            wts.errs.Out 404
        Else
            '遍历将链接等将后生成数据更新到分页集合中
            For i = 0 To n
                link_str = "index.asp?route=hello/detail&id="&wts.template.GetVali("news/id", i)
                wts.template.setVali "news/link", i, wts.route.ReWrite(wts.site.config("base_url"), link_str)
				'
                link_str = "index.asp?route=hello/edit&id="&wts.template.GetVali("news/id", i)
                wts.template.setVali "news/link_edit", i, wts.route.ReWrite(wts.site.config("base_url"), link_str)
				'
                link_str = "index.asp?route=hello/del&id="&wts.template.GetVali("news/id", i)
                wts.template.setVali "news/link_del", i, wts.route.ReWrite(wts.site.config("base_url"), link_str)
                '
                link_img = wts.route("pic").ReWritePic(wts.site.config("base_pic_url"), "image/no.gif", 50, 50, "")
                wts.template.setVali "news/pic", i, link_img
                '
                wts.template.setVali "news/time", i, wts.fun.FormatDate(wts.template.GetVali("news/times", i),1)
            Next
            '生成分页"news_page"
            oPage.Plist wts.route,wts.site.config("base_url"),"index.asp?route=hello/list"
        End If
        Set oPage = Nothing
        rs.Close
        Set rs = Nothing
        Set mHello = Nothing
		
		'添加链接
		wts.template.setVal "tag_addlink", wts.route.ReWrite(wts.site.config("base_url"), "index.asp?route=hello/add")
		
		'设置标题
		wts.template.SetVal "title","WTS列表,翻页演示"
		
		'渲染模板
        moban = wts.template.Fetch("hello_list.htm")
		
        '输出内容
        wts.responses.SetOutput moban
		
        
详情页演示
        '接收参数
        id = wts.valid.IntNum(wts.requests.querystr("id"), 0, 0, "")
        wts.template.SetVal "tag_id", id
		
		'调用模型
        Set mHello = loader.LoadModel("hello")
        Set rs = mHello.GetNameById(id)
        If rs.recordcount>0 Then
            wts.template.SetVal "tag_name", rs("name")
		    wts.template.SetVal "title",rs("name")
			'meta
		    wts.template.SetVal "meta/name","description"
		    wts.template.SetVal "meta/content",rs("name")
	        wts.template.UpdVal "meta"
        Else
            wts.template.SetVal "tag_name", "no name"
        End If
        rs.Close
        Set rs = Nothing
        Set mHello = Nothing
		
		'渲染模板
        moban = wts.template.Fetch("hello_detail.htm")
		
		'输出内容
        wts.responses.SetOutput moban