官方的提供的3G手机版本,默认读的模板是 template/3g/article/list.html
今天提供一下小修改,让3G的每个栏目都支持绑定不同的模板。
具体修改如下:
打开3g/include/3gcls.asp
找到如下代码
Dim RSObj
If DataBaseType=1 Then
Dim Cmd : Set Cmd = Server.CreateObject("ADODB.Command")
Set Cmd.ActiveConnection=conn
Cmd.CommandText="KS_ShowClass"
Cmd.CommandType=4
CMD.Prepared = true
Cmd.Parameters.Append cmd.CreateParameter("@ClassID",3,1,,ID)
Set RSObj=Cmd.Execute
Set Cmd=Nothing
Else
Set RSObj=Conn.Execute("Select top 1 ID,ClassPurview,TN,FolderTemplateID,FolderDomain,DefaultArrGroupID,ChannelID From KS_Class Where ClassID=" & ID)
End If
IF RSObj.Eof And RSObj.Bof Then RSObj.Close:Set RSObj=Nothing:Call KS.Alert("非法参数!",""):Exit Sub
If RSObj("ClassPurview")=2 and RSObj("channelid")<>8 Then
If Cbool(KSUser.UserLoginChecked)=false Then
Call KS.Alert("本栏目为认证栏目,至少要求本站的注册会员才能浏览!",KS.GetDomain & "user/login/"):Response.End
elseIF KS.FoundInArr(RSObj("DefaultArrGroupID"),KSUser.GroupID,",")=false Then
Call KS.Alert("对不起,你所在的用户级没有权限浏览!",Request.ServerVariables("http_referer")):Response.End
End If
End If
ModelID=RSObj("ChannelID")
ClassID=RSObj("ID")
Call FCls.SetClassInfo(ModelID,ClassID,RSObj("TN"))
RSObj.Close:Set RSObj=Nothing
Else
ModelID=KS.ChkClng(Request("ModelID"))
Call FCls.SetClassInfo(ModelID,0,0)
TopNum=500 '没有传栏目ID,限制只查询500条记录
If TopNum<>0 Then TopStr=" Top " & TopNum
End If
if KS.ChkClng(request("tid"))<>0 then ModelID=9
F_C = KSR.LoadTemplate(KS.Setting(3) & KS.Setting(90) & TemplatePath & "/" & KS.C_S(ModelID,10) &"/list.html")
InitialCommon
F_C = KSR.KSLabelReplaceAll(F_C)
修改为
Dim RSObj
If DataBaseType=1 Then
Dim Cmd : Set Cmd = Server.CreateObject("ADODB.Command")
Set Cmd.ActiveConnection=conn
Cmd.CommandText="KS_ShowClass"
Cmd.CommandType=4
CMD.Prepared = true
Cmd.Parameters.Append cmd.CreateParameter("@ClassID",3,1,,ID)
Set RSObj=Cmd.Execute
Set Cmd=Nothing
Else
Set RSObj=Conn.Execute("Select top 1 ID,ClassPurview,TN,FolderTemplateID,WapFolderTemplateID,FolderDomain,DefaultArrGroupID,ChannelID From KS_Class Where ClassID=" & ID)
End If
IF RSObj.Eof And RSObj.Bof Then RSObj.Close:Set RSObj=Nothing:Call KS.Alert("非法参数!",""):Exit Sub
If RSObj("ClassPurview")=2 and RSObj("channelid")<>8 Then
If Cbool(KSUser.UserLoginChecked)=false Then
Call KS.Alert("本栏目为认证栏目,至少要求本站的注册会员才能浏览!",KS.GetDomain & "user/login/"):Response.End
elseIF KS.FoundInArr(RSObj("DefaultArrGroupID"),KSUser.GroupID,",")=false Then
Call KS.Alert("对不起,你所在的用户级没有权限浏览!",Request.ServerVariables("http_referer")):Response.End
End If
End If
ModelID=RSObj("ChannelID")
ClassID=RSObj("ID")
Dim Templateid:TemplateID=RSObj("WapFolderTemplateID")
If TemplateID="" Then TemplateID=KS.Setting(3) & KS.Setting(90) & TemplatePath & "/" & KS.C_S(ModelID,10) &"/list.html"
Call FCls.SetClassInfo(ModelID,ClassID,RSObj("TN"))
RSObj.Close:Set RSObj=Nothing
Else
ModelID=KS.ChkClng(Request("ModelID"))
Call FCls.SetClassInfo(ModelID,0,0)
TopNum=500 '没有传栏目ID,限制只查询500条记录
If TopNum<>0 Then TopStr=" Top " & TopNum
End If
if KS.ChkClng(request("tid"))<>0 then ModelID=9
F_C = KSR.LoadTemplate(TemplateID)
InitialCommon
F_C = KSR.KSLabelReplaceAll(F_C)
上面红色地方为增加或是修改的地方。
对于使用SQL数据库的用户,打开数据库,找到存储过程KS_ShowClass
双击编辑
将原来的存储过程语句
CREATE PROCEDURE [KS_ShowClass]
@classid int=0
AS
set nocount on
Select top 1 ID,ClassPurview,TN,FolderTemplateID,FolderDomain,DefaultArrGroupID,ChannelID From KS_Class Where ClassID=@classid
GO
改为
CREATE PROCEDURE [KS_ShowClass]
@classid int=0
AS
set nocount on
Select top 1 ID,ClassPurview,TN,FolderTemplateID,WapFolderTempalteID,FolderDomain,DefaultArrGroupID,ChannelID From KS_Class Where ClassID=@classid