一个小巧实用的asp cms ---- NCMS

http://www.google.com/search?hl=zh-CN&q=ncms&lr=lang_zh-CN

要做一个asp网站,基本都是新闻,和一些单篇的文章,公告。 所以在网上找到这个NCMS。压缩包只有300k,算的上小巧了。功能不多,主要是新闻,公告,广告管理,用户管理,再就是模版管理,新闻采集,数据压缩备份。新闻是无限分类的,实用!~生成静态文件!~ 可以发单篇的文章,自定义文件名和模版!周到!~~这个cms简单实用,适合小型建站!  我刚刚上手,还不是很熟悉。修改了一下他的function.asp文件,给生成新闻文件的地方加了个pclass标记,作用是显示文章的分类名称

function createnewsfile(id)
 dim rs,sql,pclass
 set rs = server.createobject("adodb.recordset")
 sql = "select id,classid,title,content,author,source,keywords,bimg,simg,filename,pagetype,addtime from NCMS_news where id=" & id
 rs.open sql,conn,1,1
 dim databox:databox = rs.getrows()
 rs.close
 rs.open "select * from ncms_class where id=" & databox(1,0),conn,1,1
 pclass=rs("cname")
 rs.close
 set rs = nothing
 dim Temp:Temp = ""
 if databox(10,0) = 0 then
  Temp = processcustomtag(loadtempletfile("../templet/" & getclassall(databox(1,0),2) & ""))
 else
  Temp = processcustomtag(loadtempletfile("../templet/" & site_stemp & ""))
 end if
 dim charclass
 set charclass = new stringclass
 dim PatrnStr,AdvCont
  PatrnStr = ".*?"
  Temp = charclass.replacestr(PatrnStr,Temp,"" & charclass.getstr(databox(2,0)) & " - " & site_name & "")
  PatrnStr = "\{\$pclass\$\}"
  Temp = charclass.replacestr(PatrnStr,Temp,pclass)
  PatrnStr = "{news:[^<>]+?\/}"
  Temp = charclass.newscustomtag(PatrnStr,Temp,databox(1,0),databox(0,0),databox(6,0))
  PatrnStr = "\{\$id\$\}"
  Temp = charclass.replacestr(PatrnStr,Temp,databox(0,0))
  PatrnStr = "\{\$classid\$\}"
  Temp = charclass.replacestr(PatrnStr,Temp,databox(1,0))
  PatrnStr = "\{\$title\$\}"
  Temp = charclass.replacestr(PatrnStr,Temp,databox(2,0))
  PatrnStr = "\{\$author\$\}"
  Temp = charclass.replacestr(PatrnStr,Temp,databox(4,0))
  PatrnStr = "\{\$source\$\}"
  Temp = charclass.replacestr(PatrnStr,Temp,databox(5,0))
  PatrnStr = "\{\$keywords\$\}"
  Temp = charclass.replacestr(PatrnStr,Temp,databox(6,0))
  PatrnStr = "\{\$click\$\}"
  Temp = charclass.replacestr(PatrnStr,Temp,click(databox(0,0)))
  PatrnStr = "\{\$addtime\$\}"
  Temp = charclass.replacestr(PatrnStr,Temp,databox(11,0))
  PatrnStr = "\{\$guide\$\}"
  Temp = charclass.replacestr(PatrnStr,Temp,guide(databox(1,0)))
  PatrnStr = "\{\$search\$\}"
  Temp = charclass.replacestr(PatrnStr,Temp,search())
  PatrnStr = "\{\$toolbar\$\}"
  Temp = charclass.replacestr(PatrnStr,Temp,toolbar(databox(0,0)))
  PatrnStr = "\{\$description\$\}"
  Temp = charclass.replacestr(PatrnStr,Temp,site_description)
  PatrnStr = "\{\$copyright\$\}"
  Temp = charclass.replacestr(PatrnStr,Temp,site_copyright)
  PatrnStr = "\{\$root\$\}"
  Temp = charclass.replacestr(PatrnStr,Temp,site_root)
  PatrnStr = "\{\$advarea\$\}"
  AdvCont = databox(3,0)
  AdvCont = charclass.replacestr(PatrnStr,AdvCont,advshow(site_advcode))
 dim tempArr,n,sPATH,ePATH,cPATH:cPATH = "" & site_root & "/" & site_html & "/" & getclasspath(databox(1,0)) & "/"
 if instr(databox(9,0),"/") = 0 then
  createdir(server.mappath(cPATH))
 else
  tempArr = split(databox(9,0),"/")
  for n = 0 to ubound(tempArr)
   ePATH = replace(databox(9,0),tempArr(n),"")
  next
  createdir(server.mappath(cPATH & ePATH))
 end if
 dim TTemp:TTemp = Temp
 dim arrcont:arrcont = split(AdvCont,"{$split$}",-1,1)
 dim PageHTM:PageHTM = ""
 dim i,j,k:k = ubound(arrcont)
 for i = 0 to k
  if i = 0 then
   sPATH = "" & cPATH & databox(9,0) & site_extname & ""
  else
   sPATH = "" & cPATH & databox(9,0) & site_extname & ""
   sPATH = left(sPATH,(len(sPATH)-len(site_extname))) & "_" & i + 1 & site_extname
  end if
  if sPATH = "" then
   createnewsfile = false
   exit function
  end if
  if k >= 1 then
   PageHTM = "

【本新闻共" & k + 1 & "页】-"
   if i = 0 then
    PageHTM = PageHTM & "【首页】-"
    PageHTM = PageHTM & "【上页】-"
   end if
   if i > 1 then
    PageHTM = PageHTM & "【首页】-"
    PageHTM = PageHTM & "【上页】-"
   end if
   if i = 1 Then
    PageHTM = PageHTM & "【首页】-"
    PageHTM = PageHTM & "【上页】-"
   end if
   if i < k then
    PageHTM = PageHTM & "【下页】-"
    PageHTM = PageHTM & "【尾页】-"
   end if
   if i = k then
    PageHTM = PageHTM & "【下页】-"
    PageHTM = PageHTM & "【尾页】-"
   end if
   PageHTM = PageHTM & "【当前在第" & i + 1 & "页】

"
  else
   PageHTM = ""
  end if
  PatrnStr = "\{\$content\$\}"
  Temp = charclass.replacestr(PatrnStr,TTemp,"" & chr(10) & "
" & chr(10) & arrcont(i) & PageHTM & chr(10) & "
" & chr(10))
  dim objstream
  set objstream = server.createobject("adodb.stream")
  with objstream
   .open
   .charset = "" & chrset & ""
   .position = objstream.size
   .writetext = Temp
   .savetofile server.mappath(sPATH),2
   .close
  end with
  set objstream = nothing
 next
 if err.number <> 0 then
  err.clear
  createnewsfile = false
 else
  conn.execute("update NCMS_news set created=1 where id=" & databox(0,0))
  createnewsfile = true
  databox = ""
 end if
end function

你可能感兴趣的:(一个小巧实用的asp cms ---- NCMS)