A seguir, o fragmento de código: <% '============================================ 'Nome do processo: ShowCorrelative 'Função: mostre artigos relacionados Parâmetros: Articlenum ---- Quantos artigos são exibidos no máximo 'Titlelen ---- o número de caracteres no título, um caractere chinês = dois caracteres em inglês '============================================ Sub Showcorrelave (Articlenum, Titlelen) Dim RS, SQL Dim Strkey, Arrkey, eu se articlenum> 0 e articlenum <= 100 então SQL = Selecione Top & Articlenum outro Sql = selecione Top 5 final se 'Use | símbolos para dividir as palavras -chave Strkey = MID (Rs (chave), 2, Len (Rs (chave)-2) Se Instr (strkey, |)> 1 então Arrkey = Split (strkey, |) strkey = ((chave como '% | & arrkey (0) & |%') para i = 1 a ubound (arrkey) Strkey = strkey & ou (chave como '% | & arrkey (i) & |%') próximo Strkey = strkey &) outro Strkey = (chave como '% | & strkey & |%') final se Sql = & id, título, autor, data, hits, l.layoutfilename do artigo A interno de layout de junção l em l.layoutId = layoutId where excluído = false e aprovado = true a nd & strkey & e id <> & id & order Por id desc SET RS = const.execute (SQL) Se titlelen <0 ou titlelen> 255, então tintlelen = 50 Se Rs.Bof e Rs.eof então Response.Write não tem artigos relacionados outro Faça enquanto não é Rs.eof Response.write <a href = '& rs (layoutFilename) &? Hora: & rs (data) & vbcrlf & cliques: & rs (hits) & '> & gottopic (rs (título), titlelen) & </a> rs.movenext laço final se Rs.close Definir rs = nada final sub %> |
Depois de definir esse processo, substitua a marca do modelo no arquivo da página estática
(Como: htmlmake.asp)
| A seguir, o fragmento de código: Pencat = Substitua (Pencat, [XianghuanList], ShowCorrelative (5,20)) |
Isso gerará uma página estática com uma lista de artigos relacionados!
A parte vermelha é a declaração principal que pode ser transplantada apenas.
A seguir, o fragmento de código: <% '============================================ 'Nome do processo: ShowCorrelative 'Função: mostre artigos relacionados Parâmetros: Articlenum ---- Quantos artigos são exibidos no máximo 'Titlelen ---- o número de caracteres no título, um caractere chinês = dois caracteres em inglês '============================================ Sub Showcorrelave (Articlenum, Titlelen) Dim RS, SQL Dim Strkey, Arrkey, eu se articlenum> 0 e articlenum <= 100 então SQL = Selecione Top & Articlenum outro Sql = selecione Top 5 final se 'Use | símbolos para dividir as palavras -chave Strkey = MID (Rs (chave), 2, Len (Rs (chave)-2) Se Instr (strkey, |)> 1 então Arrkey = Split (strkey, |) strkey = ((chave como '% | & arrkey (0) & |%') para i = 1 a ubound (arrkey) Strkey = strkey & ou (chave como '% | & arrkey (i) & |%') próximo Strkey = strkey &) outro Strkey = (chave como '% | & strkey & |%') final se Sql = & id, título, autor, data, hits, l.layoutfilename do artigo A interno de layout de junção l em l.layoutId = layoutId where excluído = false e aprovado = true a nd & strkey & e id <> & id & order Por id desc SET RS = const.execute (SQL) Se titlelen <0 ou titlelen> 255, então tintlelen = 50 Se Rs.Bof e Rs.eof então Response.Write não tem artigos relacionados outro Faça enquanto não é Rs.eof Response.write <a href = '& rs (layoutFilename) &? Hora: & rs (data) & vbcrlf & cliques: & rs (hits) & '> & gottopic (rs (título), titlelen) & </a> rs.movenext laço final se Rs.close Definir rs = nada final sub %> |
Depois de definir esse processo, substitua a marca do modelo no arquivo da página estática
(Como: htmlmake.asp)
| A seguir, o fragmento de código: Pencat = Substitua (Pencat, [XianghuanList], ShowCorrelative (5,20)) |
Isso gerará uma página estática com uma lista de artigos relacionados!
A parte vermelha é a declaração principal que pode ser transplantada apenas.