1. In order to realize this function, we first need to obtain the current page number and total page number of the image page.
Edit include/inc_archives_view.php file
(1) Find function ParseDMFields and modify it to:
function ParseDMFields($pageNo,$ismake=1)
{
$this->NowPage = $pageNo;
//Get the current page number
$this->Fields['cpagenum'] = $this->NowPage;
if($this->SplitPageField!="" &&
isset($this->Fields[$this->SplitPageField]))
{
$this->Fields[$this->SplitPageField] = $this->SplitFields[$pageNo - 1];
}
Note that the following code has been added to obtain the current page number:
$this->Fields['cpagenum'] = $this->NowPage;
(2) Find the function __construct constructor and modify it to:
<?php
……
$this->TotalPage = count($this->SplitFields);
}
//Get the total number of current pages
$this->Fields['totalpage'] = $this->TotalPage;
$this->LoadTemplet();
$this->ParseTempletsFirst();
}
Note that the following code has been added to obtain the total page number:
$this->Fields['totalpage'] = $this->TotalPage;
2. Next, use js to analyze static pages and dynamic pages and turn pages down
Edit article_image.htm or the template that your picture album finally displays, and add the following js code:
<script language="javascript">
var npage = {dede:field name='cpagenum'/};
var totalpage = {dede:field name='totalpage'/};
var filename="";
var curl=;
function goNextPic(){
str1 = /\.html/ig;
str2 = /_/ig;
r = (str1);
r1 = (str2);
if(r>0){
if(npage==1) filename = (0,r);
else filename = (0,r1);
if(npage==totalpage){ = filename+".html"; }
else{
= filename+"_"+(npage+1)+".html";
}
}else{
if(npage==totalpage){ = "?aid={dede:field name='id'/}"; }
else{
= "?aid={dede:field name='id'/}&pageno="+(npage+1);
}
}
}
</script>
In this js script, we define a method goNextPic to switch to the next image.
3. Finally modify the image output code and complete the goNextPic method call
Modify include/inc_channel_unit.php
Find the section "//All Listed or Paginated Gallery".
Modification is similar (read the code carefully and you need to modify several places):
$revalue = "<center><a href='$src' target='_blank'><img src='$src' alt='$alt' $iw border='0'/></a><br/>$alt<br/></center>\r\n";
for:
$revalue = "<center><a href='javascript:goNextPic();'><img src='$src' alt='$alt' $iw border='0'/></a><br/>$alt<br/></center> ";
Edit include/inc_archives_view.php file
(1) Find function ParseDMFields and modify it to:
function ParseDMFields($pageNo,$ismake=1)
{
$this->NowPage = $pageNo;
//Get the current page number
$this->Fields['cpagenum'] = $this->NowPage;
if($this->SplitPageField!="" &&
isset($this->Fields[$this->SplitPageField]))
{
$this->Fields[$this->SplitPageField] = $this->SplitFields[$pageNo - 1];
}
Note that the following code has been added to obtain the current page number:
$this->Fields['cpagenum'] = $this->NowPage;
(2) Find the function __construct constructor and modify it to:
<?php
……
$this->TotalPage = count($this->SplitFields);
}
//Get the total number of current pages
$this->Fields['totalpage'] = $this->TotalPage;
$this->LoadTemplet();
$this->ParseTempletsFirst();
}
Note that the following code has been added to obtain the total page number:
$this->Fields['totalpage'] = $this->TotalPage;
2. Next, use js to analyze static pages and dynamic pages and turn pages down
Edit article_image.htm or the template that your picture album finally displays, and add the following js code:
<script language="javascript">
var npage = {dede:field name='cpagenum'/};
var totalpage = {dede:field name='totalpage'/};
var filename="";
var curl=;
function goNextPic(){
str1 = /\.html/ig;
str2 = /_/ig;
r = (str1);
r1 = (str2);
if(r>0){
if(npage==1) filename = (0,r);
else filename = (0,r1);
if(npage==totalpage){ = filename+".html"; }
else{
= filename+"_"+(npage+1)+".html";
}
}else{
if(npage==totalpage){ = "?aid={dede:field name='id'/}"; }
else{
= "?aid={dede:field name='id'/}&pageno="+(npage+1);
}
}
}
</script>
In this js script, we define a method goNextPic to switch to the next image.
3. Finally modify the image output code and complete the goNextPic method call
Modify include/inc_channel_unit.php
Find the section "//All Listed or Paginated Gallery".
Modification is similar (read the code carefully and you need to modify several places):
$revalue = "<center><a href='$src' target='_blank'><img src='$src' alt='$alt' $iw border='0'/></a><br/>$alt<br/></center>\r\n";
for:
$revalue = "<center><a href='javascript:goNextPic();'><img src='$src' alt='$alt' $iw border='0'/></a><br/>$alt<br/></center> ";