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