打造最全的CMS类教程聚合!
1、为了实现这个功能,我们首先需要获得图片页面的当前页码和总页码
编辑include/inc_archives_view.php文件
(1)找到function ParseDMFields,修改为:
01 |
function ParseDMFields($pageNo,$ismake=1) |
03 |
$this->NowPage = $pageNo; |
05 |
$this->Fields['cpagenum'] = $this->NowPage; |
06 |
if($this->SplitPageField!="" && |
07 |
isset($this->Fields[$this->SplitPageField])) |
09 |
$this->Fields[$this->SplitPageField] = $this->SplitFields[$pageNo - 1]; |
注意增加了如下代码用来获得当前的页码:
1 |
$this->Fields['cpagenum'] = $this->NowPage; |
(2)找到function __construct构造函数,修改为:
1 |
$this->TotalPage = count($this->SplitFields); |
4 |
$this->Fields['totalpage'] = $this->TotalPage; |
6 |
$this->ParseTempletsFirst(); |
注意增加了如下代码用来获得总页码:
1 |
$this->Fields['totalpage'] = $this->TotalPage; |
1 |
< span style = "padding: 0px; margin: 0px 3px; color: rgb(68, 68, 68); font-family: "microsoft yahei", verdana, arial; font-size: 13px; line-height: 24px; white-space: normal; background-color: rgb(255, 255, 255);" >2、接下来在模板中用js实现分析静态页面和动态页面以及向下翻页 </ span > < span style = "padding: 0px; margin: 0px 3px; color: rgb(68, 68, 68); font-family: "microsoft yahei", verdana, arial; font-size: 13px; line-height: 24px; white-space: normal; background-color: rgb(255, 255, 255);" >编辑article_image.htm或者你的图集最终显示的模板,增加如下js代码:</ span > |
01 |
< script language = "javascript" > |
02 |
var npage = {dede:field/}; |
03 |
var totalpage = {dede:field/}; |
05 |
var curl=location.href; |
10 |
r = curl.search(str1); |
11 |
r1 = curl.search(str2); |
13 |
if(npage==1) filename = curl.substr(0,r); |
14 |
else filename = curl.substr(0,r1); |
16 |
if(npage==totalpage){ location.href = filename+".html"; } |
18 |
location.href = filename+"_"+(npage+1)+".html"; |
21 |
if(npage==totalpage){ location.href = "view.php?aid={dede:field/}"; } |
23 |
location.href = "view.php?aid={dede:field/}&pageno="+(npage+1); |
在这个js脚本中,我们定义一个方法goNextPic用来切换到下一个图片。
3、最后修改图片输出代码,完成goNextPic方法调用
修改include/inc_channel_unit.php
找到”//全部列出式或分页式图集”的部分。
修改类似(仔细看代码,需要修改好几个地方):
1 |
< span style = "padding: 0px; margin: 0px 3px; color: rgb(68, 68, 68); font-family: "microsoft yahei", verdana, arial; font-size: 13px; line-height: 24px; white-space: normal; background-color: rgb(255, 255, 255);" >$revalue = "< center >< a href = '$src' target = '_blank' >< img src = '$src' alt = '$alt' $iw/></ a >< br />$alt< br /></ center >\r\n"; </ span > |
为:
1 |
< span style = "padding: 0px; margin: 0px 3px; color: rgb(68, 68, 68); font-family: "microsoft yahei", verdana, arial; font-size: 13px; line-height: 24px; white-space: normal; background-color: rgb(255, 255, 255);" >$revalue = "< center >< a href = 'javascript:goNextPic();' >< img src = '$src' alt = '$alt' $iw/></ a >< br />$alt< br /></ center > ";</ span >
|
|