The following is the code fragment: <% '========================================== 'Process name: ShowCorrelative 'Function: Show related articles 'Parameters: Articlenum ---- How many articles are displayed at most 'TitleLen ---- The number of characters in the title, one Chinese character = two English characters '========================================== Sub Showcorrelave (Articlenum, TitleLEN) dim rs, sql Dim Strkey, Arrkey, I if Articlenum> 0 and Articlenum <= 100 THEN SQL = SELECT TOP & Articlenum else SQL = SELECT TOP 5 end if 'Use | symbols to divide the keywords Strkey = MID (RS (Key), 2, Len (RS (KEY))-2) if instr (strkey, |)> 1 then Arrkey = Split (Strkey, |) strkey = ((key like '% | & arrkey (0) & |%') for i = 1 to ubound (Arrkey) Strkey = Strkey & OR (Key Like '% | & Arrkey (I) & |%') next Strkey = Strkey &) else Strkey = (key like '% | & strkey & |%') end if SQL = & ID, Title, Author, Date, HITS, L.Layoutfilename From Article A Inner Join Layout L on L.Layoutid = Layoutid where deleted = False and Passed = TRUE A ND & Strkey & and ID <> & ID & Order By Id desc Set rs = const.execute (SQL) If TitleLen <0 or TitleLen> 255 THEN TINTLELEN = 50 if rs.bof and rs.eof then response.write has no related articles else do while not rs.eof Response.write <A href = '& rs (layoutfilename) &? ID = & rs (ID) &' title = 'Article Title: & RS (Title) & VBCRLF & Article Author: & RS (Author) & VBCRLF & Update Time: & RS (Date) & VBCRLF & Clicks: & RS (HITS) & '> & Gottopic (RS (Title), Titlelen) & </a> rs.movenext loop end if RS.Close set rs = Nothing end sub %> |
After defining this process, then replace the template mark in the file of the static page
(Such as: htmlmake.asp)
The following is the code fragment: Pencat = Replace (Pencat, [xianghuanlist], showcorrelative (5,20)) |
This will generate a static page with a list of related articles!
The red part is the core statement that can be transplanted only.
The following is the code fragment: <% '========================================== 'Process name: ShowCorrelative 'Function: Show related articles 'Parameters: Articlenum ---- How many articles are displayed at most 'TitleLen ---- The number of characters in the title, one Chinese character = two English characters '========================================== Sub Showcorrelave (Articlenum, TitleLEN) dim rs, sql Dim Strkey, Arrkey, I if Articlenum> 0 and Articlenum <= 100 THEN SQL = SELECT TOP & Articlenum else SQL = SELECT TOP 5 end if 'Use | symbols to divide the keywords Strkey = MID (RS (Key), 2, Len (RS (KEY))-2) if instr (strkey, |)> 1 then Arrkey = Split (Strkey, |) strkey = ((key like '% | & arrkey (0) & |%') for i = 1 to ubound (Arrkey) Strkey = Strkey & OR (Key Like '% | & Arrkey (I) & |%') next Strkey = Strkey &) else Strkey = (key like '% | & strkey & |%') end if SQL = & ID, Title, Author, Date, HITS, L.Layoutfilename From Article A Inner Join Layout L on L.Layoutid = Layoutid where deleted = False and Passed = TRUE A ND & Strkey & and ID <> & ID & Order By Id desc Set rs = const.execute (SQL) If TitleLen <0 or TitleLen> 255 THEN TINTLELEN = 50 if rs.bof and rs.eof then response.write has no related articles else do while not rs.eof Response.write <A href = '& rs (layoutfilename) &? ID = & rs (ID) &' title = 'Article Title: & RS (Title) & VBCRLF & Article Author: & RS (Author) & VBCRLF & Update Time: & RS (Date) & VBCRLF & Clicks: & RS (HITS) & '> & Gottopic (RS (Title), Titlelen) & </a> rs.movenext loop end if RS.Close set rs = Nothing end sub %> |
After defining this process, then replace the template mark in the file of the static page
(Such as: htmlmake.asp)
The following is the code fragment: Pencat = Replace (Pencat, [xianghuanlist], showcorrelative (5,20)) |
This will generate a static page with a list of related articles!
The red part is the core statement that can be transplanted only.