海口秀英隆智慧網絡科技工作室
咨詢熱線:400-822-8458 客戶服務:0898-32183600

eWebeditor V2.8增加分頁功能!

發表于: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>&nbsp;<a href="&link&"&page="&(page-1)&">上一(yī)頁</a>&nbsp;"
  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 &"&nbsp;"
 else
 response.Write"<a href="&link&"&page="&p&">"&p&"</a>"&"&nbsp;"
 end if
p=p+1
loop

'得到下一(yī)頁、最後頁鏈接
  if page<zpage then
  response.write"<a href="&link&"&page="&(page+1)&">下一(yī)頁</a>&nbsp;<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)%>

文章(zhāng)整理(lǐ): 世紀雲圖  /

以上信息與文章(zhāng)正文是不可(kě)分割的(de)一(yī)部分,如(rú)果您要轉載本文章(zhāng),請保留以上信息,謝謝!

版權申明:本站文章(zhāng)部份來自(zì)網絡,如(rú)有侵權,請聯系我們,我們收到後立即删除,謝謝!

特别注意:本站部份轉載文章(zhāng)言論不代表本站觀點,本站所提供的(de)攝影照片,插畫,設計作品,如(rú)需使用,請與原作者聯系,版權歸原作者所有。

微信
網站建設
軟件業務
網絡營銷
400電話