1.2分页
作者:cmscn 日期:2005-04-11
先在后台执行SQL
alter TABLE [article] ADD COLUMN [Typea] text(20)
update article set Typea=0
1,打开/include/admin_config_edit.asp
找到
<tr>
<td>表格高度系数:</td>
在上面加上
<tr>
<td>文章分页:</td>
<td><input type=text name=web_num_31 value='<%response.write tdim(31)%>' size=10 maxlength=20> 字节</td>
<td class=gray>文章分页字数</td>
</tr>
2,user_put.asp
找到:
sub put_art()
在下一句
dim topic,keyes,comto,author,power,emoney,username,tim,counter,istop,hidden,word
改为:
dim topic,keyes,comto,author,power,emoney,username,tim,counter,istop,hidden,word,typea
找到:
keyes=code_admin("keyes",1,20)
在上面加上:
typea=code_admin("typea",1,10)
找到 :
rs("word")=word
下面加上:
rs("typea")=typea
找到 :
<tr class=bg_td>
<td valign=top><%response.write tit_fir%>内容:</td>
<td><textarea name=word rows=15 cols=65></textarea></td>
</tr>
在下面加上:
<tr class=bg_td>
<td>分页方式:</td>
<td><select type=text name="Typea" id="Typea">
<option value="0" <%if session("Typea")=0 then response.write " selected"%>>不分页</option>
<option value="1" <%if session("Typea")=1 then response.write " selected"%>>自动分页</option>
<option value="2" <%if session("Typea")=2 then response.write " selected"%>>手动分页</option>
</select> <strong><font color="#0000FF">注:</font></strong><font color="#0000FF">手动分页符标记为“</font><font color="#FF0000"> [-分页-] </font><font color="#0000FF">”,注意大小写</font></td>
</tr>
/include/con_article.asp
找到下面的:
word=rs("word")
if int(cod)=1 then strContent=code_jk(word)
strContent=word
改为:
strContent=rs("word")
if int(cod)=1 then strContent=code_jk(strContent)
sub Content()
dim typea
sql="select * from article where id="&id
set rs=joekoe_cms.exec(sql,1)
word=rs("word")
Typea=rs("Typea")
下加上if int(cod)=1 then word=code_jk(word)
章分页功能
修改 article_view.asp
找到
response.write "<font id=""font_word"" class=htd style=""font-size:14px; font-family:宋体, Verdana, Arial, Helvetica, sans-serif;"">"&word&"</font>"
%><font id=""font_word"" class=htd style=""font-size:14px; font-family:宋体, Verdana, Arial, Helvetica, sans-serif;""><%
call agination()
%></font><%
修改:admin_config_edit.asp
找到:
<tr>
<td>头像数量:</td>
<td><input type=text name=web_num_5 value='<%response.write tdim(5)%>' size=10 maxlength=20> 个,目录及名称:images/face/(*).gif</td>
<td class=gray>网站可用用户头像的总数</td>
</tr>
下面增加
<tr>
<td>文章分页:</td>
<td><input type=text name=web_num_31 value='<%response.write tdim(31)%>' size=10 maxlength=20> 字节</td>
<td class=gray>文章分页字数</td>
</tr>
web_num_31不一定你也可以,如你修改过,请改为你的最后一个数
修改:con_article.asp
最下一个%>
下增加:
sub agination()
dim ArticleID,strContent,CurrentPage,strFileName,word
dim ContentLen,MaxPerPage,pages,i,lngBound
dim BeginPoint,EndPoint
sql="select * from article where id="&id
set rs=joekoe_cms.exec(sql,1)
word=rs("word")
strContent=code_jk(word)
ContentLen=len(strContent)
CurrentPage=trim(request("ArticlePage"))
if ContentLen<=int(dim_num(31)) then
response.write strContent
response.write "</p><p align='center'><font color='red'><b>[1]</b></font></p>"
else
if CurrentPage="" then
CurrentPage=1
else
CurrentPage=Cint(CurrentPage)
end if
pages=ContentLen\int(dim_num(31))
if int(dim_num(31))*pages<ContentLen then
pages=pages+1
end if
lngBound=ContentLen '最大误差范围
if CurrentPage<1 then CurrentPage=1
if CurrentPage>pages then CurrentPage=pages
dim lngTemp
dim lngTemp1,lngTemp1_1,lngTemp1_2,lngTemp1_1_1,lngTemp1_1_2,lngTemp1_1_3,lngTemp1_2_1,lngTemp1_2_2,lngTemp1_2_3
dim lngTemp2,lngTemp2_1,lngTemp2_2,lngTemp2_1_1,lngTemp2_1_2,lngTemp2_2_1,lngTemp2_2_2
dim lngTemp3,lngTemp3_1,lngTemp3_2,lngTemp3_1_1,lngTemp3_1_2,lngTemp3_2_1,lngTemp3_2_2
dim lngTemp4,lngTemp4_1,lngTemp4_2,lngTemp4_1_1,lngTemp4_1_2,lngTemp4_2_1,lngTemp4_2_2
dim lngTemp5,lngTemp5_1,lngTemp5_2
dim lngTemp6,lngTemp6_1,lngTemp6_2
if CurrentPage=1 then
BeginPoint=1
else
BeginPoint=int(dim_num(31))*(CurrentPage-1)+1
lngTemp1_1_1=instr(BeginPoint,strContent)
lngTemp1_1_2=instr(BeginPoint,strContent)
lngTemp1_1_3=instr(BeginPoint,strContent)
if lngTemp1_1_1>0 then
lngTemp1_1=lngTemp1_1_1
elseif lngTemp1_1_2>0 then
lngTemp1_1=lngTemp1_1_2
elseif lngTemp1_1_3>0 then
lngTemp1_1=lngTemp1_1_3
else
lngTemp1_1=0
end if
lngTemp1_2_1=instr(BeginPoint,strContent)
lngTemp1_2_2=instr(BeginPoint,strContent)
lngTemp1_2_3=instr(BeginPoint,strContent)
if lngTemp1_2_1>0 then
lngTemp1_2=lngTemp1_2_1
elseif lngTemp1_2_2>0 then
lngTemp1_2=lngTemp1_2_2
elseif lngTemp1_2_3>0 then
lngTemp1_2=lngTemp1_2_3
else
lngTemp1_2=0
end if
if lngTemp1_1=0 and lngTemp1_2=0 then
lngTemp1=BeginPoint
else
if lngTemp1_1>lngTemp1_2 then
lngtemp1=lngTemp1_2
else
lngTemp1=lngTemp1_1+8
end if
end if
lngTemp2_1_1=instr(BeginPoint,strContent)
lngTemp2_1_2=instr(BeginPoint,strContent)
if lngTemp2_1_1>0 then
lngTemp2_1=lngTemp2_1_1
elseif lngTemp2_1_2>0 then
lngTemp2_1=lngTemp2_1_2
else
lngTemp2_1=0
end if
lngTemp2_2_1=instr(BeginPoint,strContent)
lngTemp2_2_2=instr(BeginPoint,strContent)
if lngTemp2_2_1>0 then
lngTemp2_2=lngTemp2_2_1
elseif lngTemp2_2_2>0 then
lngTemp2_2=lngTemp2_2_2
else
lngTemp2_2=0
end if
if lngTemp2_1=0 and lngTemp2_2=0 then
lngTemp2=BeginPoint
else
if lngTemp2_1>lngTemp2_2 then
lngtemp2=lngTemp2_2
else
lngTemp2=lngTemp2_1+4
end if
end if
lngTemp3_1_1=instr(BeginPoint,strContent)
lngTemp3_1_2=instr(BeginPoint,strContent)
if lngTemp3_1_1>0 then
lngTemp3_1=lngTemp3_1_1
elseif lngTemp3_1_2>0 then
lngTemp3_1=lngTemp3_1_2
else
lngTemp3_1=0
end if
lngTemp3_2_1=instr(BeginPoint,strContent)
lngTemp3_2_2=instr(BeginPoint,strContent)
if lngTemp3_2_1>0 then
lngTemp3_2=lngTemp3_2_1
elseif lngTemp3_2_2>0 then
lngTemp3_2=lngTemp3_2_2
else
lngTemp3_2=0
end if
if lngTemp3_1=0 and lngTemp3_2=0 then
lngTemp3=BeginPoint
else
if lngTemp3_1>lngTemp3_2 then
lngtemp3=lngTemp3_2
else
lngTemp3=lngTemp3_1+5
end if
end if
if lngTemp1<lngTemp2 then
lngTemp=lngTemp2
else
lngTemp=lngTemp1
end if
if lngTemp<lngTemp3 then
lngTemp=lngTemp3
end if
if lngTemp>BeginPoint and lngTemp<=BeginPoint+lngBound then
BeginPoint=lngTemp
else
lngTemp4_1_1=instr(BeginPoint,strContent)
lngTemp4_1_2=instr(BeginPoint,strContent)
if lngTemp4_1_1>0 then
lngTemp4_1=lngTemp4_1_1
elseif lngTemp4_1_2>0 then
lngTemp4_1=lngTemp4_1_2
else
lngTemp4_1=0
end if
lngTemp4_2_1=instr(BeginPoint,strContent)
lngTemp4_2_1=instr(BeginPoint,strContent)
if lngTemp4_2_1>0 then
lngTemp4_2=lngTemp4_2_1
elseif lngTemp4_2_2>0 then
lngTemp4_2=lngTemp4_2_2
else
lngTemp4_2=0
end if
if lngTemp4_1=0 and lngTemp4_2=0 then
lngTemp4=BeginPoint
else
if lngTemp4_1>lngTemp4_2 then
lngtemp4=lngTemp4_2
else
lngTemp4=lngTemp4_1+5
end if
end if
if lngTemp4>BeginPoint and lngTemp4<=BeginPoint+lngBound then
BeginPoint=lngTemp4
else
lngTemp5_1=instr(BeginPoint,strContent)
lngTemp5_2=instr(BeginPoint,strContent)
if lngTemp5_1>0 then
lngTemp5=lngTemp5_1
elseif lngTemp5_2>0 then
lngTemp5=lngTemp5_2
else
lngTemp5=BeginPoint
end if
if lngTemp5>BeginPoint and lngTemp5<BeginPoint+lngBound then
BeginPoint=lngTemp5
else
lngTemp6_1=instr(BeginPoint,strContent)
lngTemp6_2=instr(BeginPoint,strContent)
if lngTemp6_1>0 then
lngTemp6=lngTemp6_1
elseif lngTemp6_2>0 then
lngTemp6=lngTemp6_2
else
lngTemp6=0
end if
if lngTemp6>BeginPoint and lngTemp6<BeginPoint+lngBound then
BeginPoint=lngTemp6+4
end if
end if
end if
end if
end if
if CurrentPage=pages then
EndPoint=ContentLen
else
EndPoint=int(dim_num(31))*CurrentPage
if EndPoint>=ContentLen then
EndPoint=ContentLen
else
lngTemp1_1_1=instr(EndPoint,strContent)
lngTemp1_1_2=instr(EndPoint,strContent)
lngTemp1_1_3=instr(EndPoint,strContent)
if lngTemp1_1_1>0 then
lngTemp1_1=lngTemp1_1_1
elseif lngTemp1_1_2>0 then
lngTemp1_1=lngTemp1_1_2
elseif lngTemp1_1_3>0 then
lngTemp1_1=lngTemp1_1_3
else
lngTemp1_1=0
end if
lngTemp1_2_1=instr(EndPoint,strContent)
lngTemp1_2_2=instr(EndPoint,strContent)
lngTemp1_2_3=instr(EndPoint,strContent)
if lngTemp1_2_1>0 then
lngTemp1_2=lngTemp1_2_1
elseif lngTemp1_2_2>0 then
lngTemp1_2=lngTemp1_2_2
elseif lngTemp1_2_3>0 then
lngTemp1_2=lngTemp1_2_3
else
lngTemp1_2=0
end if
if lngTemp1_1=0 and lngTemp1_2=0 then
lngTemp1=EndPoint
else
if lngTemp1_1>lngTemp1_2 then
lngtemp1=lngTemp1_2-1
else
lngTemp1=lngTemp1_1+7
end if
end if
lngTemp2_1_1=instr(EndPoint,strContent)
lngTemp2_1_2=instr(EndPoint,strContent)
if lngTemp2_1_1>0 then
lngTemp2_1=lngTemp2_1_1
elseif lngTemp2_1_2>0 then
lngTemp2_1=lngTemp2_1_2
else
lngTemp2_1=0
end if
lngTemp2_2_1=instr(EndPoint,strContent)
lngTemp2_2_2=instr(EndPoint,strContent)
if lngTemp2_2_1>0 then
lngTemp2_2=lngTemp2_2_1
elseif lngTemp2_2_2>0 then
lngTemp2_2=lngTemp2_2_2
else
lngTemp2_2=0
end if
if lngTemp2_1=0 and lngTemp2_2=0 then
lngTemp2=EndPoint
else
if lngTemp2_1>lngTemp2_2 then
lngTemp2=lngTemp2_2-1
else
lngTemp2=lngTemp2_1+3
end if
end if
lngTemp3_1_1=instr(EndPoint,strContent)
lngTemp3_1_2=instr(EndPoint,strContent)
if lngTemp3_1_1>0 then
lngTemp3_1=lngTemp3_1_1
elseif lngTemp3_1_2>0 then
lngTemp3_1=lngTemp3_1_2
else
lngTemp3_1=0
end if
lngTemp3_2_1=instr(EndPoint,strContent)
lngTemp3_2_2=instr(EndPoint,strContent)
if lngTemp3_2_1>0 then
lngTemp3_2=lngTemp3_2_1
elseif lngTemp3_2_2>0 then
lngTemp3_2=lngTemp3_2_2
else
lngTemp3_2=0
end if
if lngTemp3_1=0 and lngTemp3_2=0 then
lngTemp3=EndPoint
else
if lngTemp3_1>lngTemp3_2 then
lngtemp3=lngTemp3_2-1
else
lngTemp3=lngTemp3_1+4
end if
end if
if lngTemp1<lngTemp2 then
lngTemp=lngTemp2
else
lngTemp=lngTemp1
end if
if lngTemp<lngTemp3 then
lngTemp=lngTemp3
end if
if lngTemp>EndPoint and lngTemp<=EndPoint+lngBound then
EndPoint=lngTemp
else
lngTemp4_1_1=instr(EndPoint,strContent)
lngTemp4_1_2=instr(EndPoint,strContent)
if lngTemp4_1_1>0 then
lngTemp4_1=lngTemp4_1_1
elseif lngTemp4_1_2>0 then
lngTemp4_1=lngTemp4_1_2
else
lngTemp4_1=0
end if
lngTemp4_2_1=instr(EndPoint,strContent)
lngTemp4_2_1=instr(EndPoint,strContent)
if lngTemp4_2_1>0 then
lngTemp4_2=lngTemp4_2_1
elseif lngTemp4_2_2>0 then
lngTemp4_2=lngTemp4_2_2
else
lngTemp4_2=0
end if
if lngTemp4_1=0 and lngTemp4_2=0 then
lngTemp4=EndPoint
else
if lngTemp4_1>lngTemp4_2 then
lngtemp4=lngTemp4_2-1
else
lngTemp4=lngTemp4_1+4
end if
end if
if lngTemp4>EndPoint and lngTemp4<=EndPoint+lngBound then
EndPoint=lngTemp4
else
lngTemp5_1=instr(EndPoint,strContent)
lngTemp5_2=instr(EndPoint,strContent)
if lngTemp5_1>0 then
lngTemp5=lngTemp5_1-1
elseif lngTemp5_2>0 then
lngTemp5=lngTemp5_2-1
else
lngTemp5=EndPoint
end if
if lngTemp5>EndPoint and lngTemp5<EndPoint+lngBound then
EndPoint=lngTemp5
else
lngTemp6_1=instr(EndPoint,strContent)
lngTemp6_2=instr(EndPoint,strContent)
if lngTemp6_1>0 then
lngTemp6=lngTemp6_1+3
elseif lngTemp6_2>0 then
lngTemp6=lngTemp6_2+3
else
lngTemp6=EndPoint
end if
if lngTemp6>EndPoint and lngTemp6<EndPoint+lngBound then
EndPoint=lngTemp6
end if
end if
end if
end if
end if
end if
response.write mid(strContent,BeginPoint,EndPoint-BeginPoint)
response.write "</p><p align='center'><b>"
if CurrentPage>1 then
response.write "<a href='" & strFileName & "?ID=" & ID & "&ArticlePage=" & CurrentPage-1 & "'>上一页</a> "
end if
for i=1 to pages
if i=CurrentPage then
response.write "<font color='red'>" & cstr(i) & "</font> "
else
response.write "<a href='" & strFileName & "?ID=" & ID & "&ArticlePage=" & i & "'>[" & i & "]</a> "
end if
next
if CurrentPage<pages then
response.write " <a href='" & strFileName & "?ID=" & ID & "&ArticlePage=" & CurrentPage+1 & "'>下一页</a>"
end if
response.write "</b></p>"
end if
end sub
1.2分页
[file=attachments/month_200507/30_155522_vsky2004112713390489.rar]Click to Download[/file]
1.2完整分页
[file=attachments/month_200507/30_155601_urjx2004091012322148.rar]Click to Download[/file]
评论: 7 | 引用: 0 | 查看次数: 758
发表评论