A small and practical asp cms-NCMS

Source: Internet
Author: User

Http://www.google.com/search? Hl = ZH-CN & Q = NCMS & LR = lang_zh-CN

To make an ASP Website, it is basically news, and some single articlesArticle, Announcement. So find this NCMS on the Internet. The compressed package is only 300 kb, Which is compact. There are not many functions, mainly news, announcements, advertising management, user management, template management, news collection, and data compression and backup. News is infinitely classified and practical !~ Generate static files !~ You can send an article, custom file names and templates! Thoughtful !~~ This CMS is simple and practical and suitable for small-sized website construction! I am not familiar with it. Modified the function. asp file and added a Pclass mark to the place where the news file was generated to display the classification name of the article.

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 (), Conn
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 (), databox (), 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" "> [news page <font color =" red ">" & K + 1 & "</font>] -"
If I = 0 then
Pagehtm = pagehtm & "[homepage ]-"
Pagehtm = pagehtm & "[Previous Page ]-"
End if
If I> 1 then
Pagehtm = pagehtm & "[<a href =" & cpath & databox (9,0) & site_extname & ""> homepage </a> ]-"
Pagehtm = pagehtm & "[<a href =" & cpath & databox (9,0) & "_" & I & site_extname & ""> previous page </a> ]-"
End if
If I = 1 then
Pagehtm = pagehtm & "[<a href =" & cpath & databox (9,0) & site_extname & ""> homepage </a> ]-"
Pagehtm = pagehtm & "[<a href =" & cpath & databox (9,0) & site_extname & ""> previous page </a> ]-"
End if
If I <k then
Pagehtm = pagehtm & "[<a href =" & cpath & databox (9,0) & "_" & I + 2 & site_extname & ""> next page </a> ]-"
Pagehtm = pagehtm & "[<a href =" & cpath & databox (9,0) & "_" & K + 1 & site_extname & ""> last page </a> ]-"
End if
If I = k then
Pagehtm = pagehtm & "[Next Page ]-"
Pagehtm = pagehtm & "[last page ]-"
End if
Pagehtm = pagehtm & "[currently on the <font color =" red ">" & I + 1 & "</font> page] </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
Set objstream = nothing
Next
If err. Number <> 0 then
Err. Clear
Createnewsfile = false
Else
Conn.exe cute ("Update ncms_news set created = 1 where id =" & databox (0, 0 ))
Createnewsfile = true
Databox = ""
End if
End Function

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.