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 = "<title>.*?</title>" Temp = charclass.replacestr(PatrnStr,Temp,"<title>" & charclass.getstr(databox(2,0)) & " - " & site_name & "</title>") 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 = "<p align=""center"">【本新聞共<font color=""red"">" & k + 1 & "</font>頁】-" if i = 0 then PageHTM = PageHTM & "【首頁】-" PageHTM = PageHTM & "【上頁】-" end if if i > 1 then PageHTM = PageHTM & "【<a href=""" & cPATH & databox(9,0) & site_extname & """>首頁</a>】-" PageHTM = PageHTM & "【<a href=""" & cPATH & databox(9,0) & "_" & i & site_extname & """>上頁</a>】-" end if if i = 1 Then PageHTM = PageHTM & "【<a href=""" & cPATH & databox(9,0) & site_extname & """>首頁</a>】-" PageHTM = PageHTM & "【<a href=""" & cPATH & databox(9,0) & site_extname & """>上頁</a>】-" end if if i < k then PageHTM = PageHTM & "【<a href=""" & cPATH & databox(9,0) & "_" & i + 2 & site_extname & """>下頁</a>】-" PageHTM = PageHTM & "【<a href=""" & cPATH & databox(9,0) & "_" & k + 1 & site_extname & """>尾頁</a>】-" end if if i = k then PageHTM = PageHTM & "【下頁】-" PageHTM = PageHTM & "【尾頁】-" end if PageHTM = PageHTM & "【當前在第<font color=""red"">" & i + 1 & "</font>頁】</p>" else PageHTM = "" end if PatrnStr = "\{\$content\$\}" Temp = charclass.replacestr(PatrnStr,TTemp,"" & chr(10) & "<div id=""content"">" & chr(10) & arrcont(i) & PageHTM & chr(10) & "</div>" & 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 |