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

eWebeditor V2.8增加分(fēn)頁功能!

發表于:2011-05-14 00:00:00來源:SOUAB.COM人氣:8335

點擊查看原圖

1、找一(yī)個合适的gif小(xiǎo)圖片做爲按鈕圖标,也可用phtoshop做一(yī)個大(dà)小(xiǎo)爲20*20,放(fàng)在eWebEditor\ButtonImage\standard目錄下(xià),命名爲Page.gif

點擊查看原圖

2、打開(kāi)eWebEditor/Include目錄下(xià)的Editor.js,添加如下(xià)紅色部分(fēn):
 case "br":   // 插入換行符
  insertHTML("<br>")
  break;
 case "Page": // 插入分(fēn)頁符
        insertHTML("[NextPage]")
        break;
 case "code":  // 代碼片段樣式

3、打開(kāi)eWebEditor/Include目錄下(xià)的menu.js,添加如下(xià)紅色部分(fēn):
  sMenu += getMenuRow("", "insert('br')", "br.gif", "插入換行符");
  sMenu += getMenuRow("", "insert('Page')", "Page.gif", "插入分(fēn)頁符");
  height = 204;

4、打開(kāi)eWebEditor數據庫eWebEditor_Button表,增加一(yī)條記錄,如圖(最後一(yī)條):

點擊查看原圖

5、登錄eWebEditor後台,點擊樣式管理---點擊你所使用樣式的 工(gōng)具欄---常用工(gōng)具欄---按鈕設置,拉到底,把“插入分(fēn)頁符”添加到已選按鈕,爲了整齊可以減掉一(yī)個用不到的按鈕,保存。
完成。在後台添加或者編輯文章,插入分(fēn)頁符看看效果。

 

========================================================

好了.ewebeditor的處理完了.現在來處理前台的顯示頁面關于分(fēn)頁的問題咯

========================================================

6.頁面調程序 (打個比方把這個保存在根目錄下(xià)文件名function.inc.asp)

<%
'文章内容分(fēn)頁
function contentfy(strcontent,page,link)
dim arycontent,zpage,fp,p
page=cint(page)
arycontent=Split(strcontent,"[NextPage]") '這兒的注意下(xià)[NextPage][ NextPage ]兩個中(zhōng)間有空格是有區别的.看你editor.js這個中(zhōng)設置的.我(wǒ)因爲這個空格沒注意.吓折騰了後兩個小(xiǎo)時.郁悶.也是因爲技術不到位勒.理解下(xià)^_^
zpage=UBound(arycontent)+1

response.Write arycontent(page-1)&"</br>"'輸出文章内容

'判斷總頁數是否大(dà)于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ī)頁的鏈接
  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整數部分(fēn)加1乘以10的頁數;如當前頁是11除以10的整數就1,1+1=2,2*10=20,顯示到20頁
if fp>=zpage then
fp=zpage
end if

p=page-(page mod 10)'計算當前頁減自身除以10餘數部分(fēn)的頁數;如當前頁是11,11除以10的餘數是1,11-1=10
if p=0 then
p=1
end if
 
do while p<=fp'如上就顯示10到20的頁數,若當前頁是10-20中(zhōng)的一(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

'得到下(xià)一(yī)頁、最後頁鏈接
  if page<zpage then
  response.write"<a href="&link&"&page="&(page+1)&">下(xià)一(yī)頁</a>&nbsp;<a href="&link&"&page="&zpage&">最後頁</a>"
  else
  response.write"下(xià)一(yī)頁  最後頁"
  end if

end if
Response.Write("</td></tr></table>")
end function
%>
 

7.在顯示内容的頁面調用  <!--#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")'數據庫中(zhōng)内容的字段名稱
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.在要顯示的内容區域插入

<%call contentfy(mcontent,page,link)%>

文章整理: 世紀雲圖  /

以上信息與文章正文是不可分(fēn)割的一(yī)部分(fēn),如果您要轉載本文章,請保留以上信息,謝謝!

版權申明:本站文章部份來自網絡,如有侵權,請聯系我(wǒ)們,我(wǒ)們收到後立即删除,謝謝!

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

微信
網站建設
軟件業務
網絡營銷
400電(diàn)話(huà)