發表于:2011-05-14 00:00:00來源:SOUAB.COM人氣:8312
1、找一(yī)個合适的(de)gif小圖片做(zuò)為(wèi)按鈕圖标,也可(kě)用phtoshop做(zuò)一(yī)個大小為(wèi)20*20,放在eWebEditor\ButtonImage\standard目錄下,命名為(wèi)Page.gif
2、打開eWebEditor/Include目錄下的(de)Editor.js,添加如(rú)下紅(hóng)色部分:
case "br": // 插入換行符
insertHTML("<br>")
break;
case "Page": // 插入分頁符
insertHTML("[NextPage]")
break;
case "code": // 代碼片段樣式
3、打開eWebEditor/Include目錄下的(de)menu.js,添加如(rú)下紅(hóng)色部分:
sMenu += getMenuRow("", "insert('br')", "br.gif", "插入換行符");
sMenu += getMenuRow("", "insert('Page')", "Page.gif", "插入分頁符");
height = 204;
4、打開eWebEditor數據庫eWebEditor_Button表,增加一(yī)條記錄,如(rú)圖(最後一(yī)條):
5、登錄eWebEditor後台,點擊樣式管理(lǐ)---點擊你所使用樣式的(de) 工具欄---常用工具欄---按鈕設置,拉到底,把“插入分頁符”添加到已選按鈕,為(wèi)了整齊可(kě)以減掉一(yī)個用不到的(de)按鈕,保存。
完成。在後台添加或者編輯文章(zhāng),插入分頁符看看效果。
========================================================
好了.ewebeditor的(de)處理(lǐ)完了.現在來處理(lǐ)前台的(de)顯示頁面關于分頁的(de)問題咯
========================================================
6.頁面調程序 (打個比方把這個保存在根目錄下文件名function.inc.asp)
<%
'文章(zhāng)內(nèi)容分頁
function contentfy(strcontent,page,link)
dim arycontent,zpage,fp,p
page=cint(page)
arycontent=Split(strcontent,"[NextPage]") '這兒的(de)注意下[NextPage]跟[ NextPage ]兩個中間有空格是有區别的(de).看你editor.js這個中設置的(de).我因為(wèi)這個空格沒注意.吓折騰了後兩個小時.郁悶.也是因為(wèi)技術不到位勒.理(lǐ)解下^_^
zpage=UBound(arycontent)+1
response.Write arycontent(page-1)&"</br>"'輸出文章(zhāng)內(nèi)容
'判斷總頁數是否大于1,是就輸出
Response.Write("<BR><BR>")
Response.Write("<table width=""95%"" border=""0"" align=""center"" cellpadding=""0"" cellspacing=""0"">")
Response.Write(" <tr>")
Response.Write("<td style=""font-size:12px;text-align:center;"">")
if zpage>1 then
response.write "共"&zpage&"頁,第"&page&"頁 "
'得到第一(yī)頁、上一(yī)頁的(de)鏈接
if page=1 then
response.write "第一(yī)頁 上一(yī)頁"
else
response.write"<a href="&link&"&page=1>第一(yī)頁</a> <a href="&link&"&page="&(page-1)&">上一(yī)頁</a> "
end if
'顯示數字頁數
fp=(int(page/10)+1)*10'計算當月前頁除以10整數部分加1乘以10的(de)頁數;如(rú)當前頁是11除以10的(de)整數就1,1+1=2,2*10=20,顯示到20頁
if fp>=zpage then
fp=zpage
end if
p=page-(page mod 10)'計算當前頁減自(zì)身除以10餘數部分的(de)頁數;如(rú)當前頁是11,11除以10的(de)餘數是1,11-1=10
if p=0 then
p=1
end if
do while p<=fp'如(rú)上就顯示10到20的(de)頁數,若當前頁是10-20中的(de)一(yī)頁,都顯示數字頁數10-20讓用戶點擊
if page=p then
response.Write p &" "
else
response.Write"<a href="&link&"&page="&p&">"&p&"</a>"&" "
end if
p=p+1
loop
'得到下一(yī)頁、最後頁鏈接
if page<zpage then
response.write"<a href="&link&"&page="&(page+1)&">下一(yī)頁</a> <a href="&link&"&page="&zpage&">最後頁</a>"
else
response.write"下一(yī)頁 最後頁"
end if
end if
Response.Write("</td></tr></table>")
end function
%>
7.在顯示內(nèi)容的(de)頁面調用 <!--#include file="function.inc.asp"-->
8.在頁面頂部插入
<%
set rsa=server.createobject("adodb.recordset")
sql="select * from Product where proid="&request.querystring("proid")
rsa.open sql,conn,1,1
mcontent=rsa("content")'數據庫中內(nèi)容的(de)字段名稱
rsa.close
'set rsa=nothing
'然後取得page的(de)值和(hé)link的(de)值:
if request.QueryString("page")="" then
page=1
else
page=request.querystring("page")
end if
link="s_show.asp?proid="&request.querystring("proid")
%>
9.在要顯示的(de)內(nèi)容區域插入
<%call contentfy(mcontent,page,link)%>