科讯CMS(Kesion)函数标签调用文章等级(星星)的方法!

2013-10-31 浏览:1514
科讯CMS(Kesion)函数标签调用文章等级(星星)的方法!
评论:(0)复制地址

 

用DW打开ks_cls/kesion.label.functioncls.asp

 
找到构造sql查询语句的通用函数,大约在438行吧
 
 
 
  '加载模型通用查询字段
  Public Sub LoadField(ByVal ModelID,ByVal PrintType,ByVal PicStyle,ByVal ShowPicFlag,ByRef FieldStr,ByRef TableName,ByRef Param)
     If ModelID="0" Then 
    TableName = "[KS_ItemInfo]" 
    FieldStr  = "I.ChannelID,I.InfoID as ID,I.Title,I.Tid,I.Intro,I.PhotoUrl,I.AddDate,I.Inputer,I.Popular,I.Fname,I.Hits"
    If PrintType=2 or (instr(LabelStyle,"{@photourl}")>0 and PrintType>2) Then Param = Param & " And I.PhotoUrl<>''"
   Else 
    TableName=KS.C_S(ModelID,2)
    Select Case KS.C_S(ModelID,6) 
     Case 1 
      FieldStr  = "I.ID,I.Title,I.Tid,I.Inputer,I.Fname,I.AddDate,I.Popular,I.Hits"
      FieldStr=FieldStr & ",I.TitleType,I.TitleFontColor,I.TitleFontType"
      If PrintType>=2 Then  FieldStr=FieldStr & ",I.PhotoUrl,I.Intro" : If PrintType=2 or (instr(LabelStyle,"{@photourl}")>0 and PrintType>2) Then Param = Param & " And I.PicNews=1"
      If PrintType>=3 Then  FieldStr=FieldStr & ",I.ReadPoint"
     Case 2  
      FieldStr  = "I.ID,I.Title,I.Tid,I.Inputer,I.Fname,I.AddDate,I.Popular,I.Hits"
      If PrintType>=2 Then FieldStr=FieldStr & ",I.PhotoUrl,I.PictureContent As Intro"
      If PrintType>=3 Then FieldStr=FieldStr & ",I.ReadPoint"
     Case 3  
      FieldStr  = "I.ID,I.Title,I.Tid,I.Inputer,I.Fname,I.AddDate,I.Popular,I.Hits"
      If PrintType>=2 Then FieldStr=FieldStr & ",I.PhotoUrl,I.DownContent As Intro,I.DownSize,I.Rank"
      If PrintType>=3 Then FieldStr=FieldStr & ",I.ReadPoint"
     Case 4  
      FieldStr  = "I.ID,I.Title,I.Tid,I.Inputer,I.Fname,I.AddDate,I.Popular,I.Hits"
      If PrintType>=2 Then FieldStr=FieldStr & ",I.PhotoUrl,I.FlashContent As Intro,I.Author,I.Rank"
      If PrintType>=3 Then FieldStr=FieldStr & ",I.ReadPoint"
     Case 5  
      FieldStr  = "I.ID,I.Title,I.Tid,I.Inputer,I.Fname,I.AddDate,I.Popular,I.Hits"
      If PrintType>=2 Then FieldStr=FieldStr & ",I.PhotoUrl,I.ProIntro As Intro,I.BigPhoto,I.Price_market,I.Price_member,I.Price,I.Price_Original,I.Discount,I.Promodel,I.Point"
      If KS.ChkClng(ParamNode.getAttribute("producttype"))<>0 Then Param =Param & " And I.ProductType="&KS.ChkClng(ParamNode.getAttribute("producttype"))
     Case 7  
      FieldStr  = "I.ID,I.Title,I.Tid,I.Inputer,I.Fname,I.AddDate,I.Popular,I.Hits"
      If PrintType>=2 Then FieldStr=FieldStr & ",I.PhotoUrl,I.MovieContent As Intro"
      If PrintType>=3 Or PicStyle=13 Or PicStyle=14 Or PicStyle=15 Then FieldStr=FieldStr & ",I.MovieAct,I.MovieDY,I.MovieDQ,I.MovieTime,I.MovieYY,I.ReadPoint,I.Rank"
      If PrintType=2 And PicStyle=15 Then FieldStr=FieldStr & ",I.MovieDy"
     Case 8  
      FieldStr  = "I.ID,I.Title,I.Tid,I.Inputer,I.Fname,I.AddDate,I.Popular,I.Hits,I.TypeID"
      If PrintType>=2 Then FieldStr=FieldStr & ",I.PhotoUrl,I.GQContent As Intro"
      If PrintType>=3 Or PicStyle=16 Or PicStyle=17 Then FieldStr=FieldStr & ",I.ValidDate,I.ContactMan,I.Tel,I.Address,I.Province,I.City,I.CompanyName"
      If KS.ChkClng(ParamNode.getAttribute("typeid"))<>0 Then Param =Param & " And I.TypeID="&KS.ChkClng(ParamNode.getAttribute("typeid"))
     Case Else  
      FieldStr  = "I.ID,I.Title,I.Tid,I.PhotoUrl,I.AddDate,I.Inputer,I.Popular,I.Fname,I.Hits"
      If PrintType=2 or (instr(LabelStyle,"{@photourl}")>0 and PrintType>2) Then Param = Param & " And I.PhotoUrl<>''"
    End Select
    If PrintType=4 Then FieldStr=FieldStr & GetDiyFieldStr(ModelID)
   End If
  End Sub
 
 
 
 
 
如果看懂代码的用户,相信很容易看出来是根据模型构造的查询字段,这里我们就以文章模型为例,找到如下代码
 
Case 1 
      FieldStr  = "I.ID,I.Title,I.Tid,I.Inputer,I.Fname,I.AddDate,I.Popular,I.Hits,I.Rank"
      FieldStr=FieldStr & ",I.TitleType,I.TitleFontColor,I.TitleFontType"
      If PrintType>=2 Then  FieldStr=FieldStr & ",I.PhotoUrl,I.Intro" : If PrintType=2 or (instr(LabelStyle,"{@photourl}")>0 and PrintType>2) Then Param = Param & " And I.PicNews=1"
      If PrintType>=3 Then  FieldStr=FieldStr & ",I.ReadPoint"
 
 
 
其中红色的,i.Rank 是我加上的,就这么简单一步,你的系统函数标签的自定义样式里就已经直接用{@Rank}这样的标签调用出文章的作者了,其它模型类似,具体想要调用的字段可以打开ks_article表查看
 
1.那这么简单,官方为什么不把所有字段都加进去呢?这样就不用用户自己加了,我方便?
 
答:我上面已经说到了考虑到性能问题,查询字段应该尽量的少.所以也不是说你查询越多越好.
 
2.为什么我按上面修改了,但我用{@字段名称}还是查询不出来呢?
 
答:检查标签属性里的范围有没有指定具体的模型,只有指定具体模型才有效,否则她查询的是KS_ItemInfo表
 
评论:(0)复制地址
发布:苗景云 | 分类:IT技术&设计 | Tags:科讯 kesion CMS

发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。