1. To achieve this function, we first need to obtain the current page number and total page number of the image page.
Edit the include/inc_archives_view.php file.
(1) locate function parsedmfields and change it:
Function parsedmfields ($ pageno, $ ismake = 1)
{
$ This-> nowpage = $ pageno;
// Obtain the number of the current page
$ 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 is added: Code Used to obtain the current page number:
$ This-> fields ['cpagenum'] = $ this-> nowpage;
(2) locate the function _ construct constructor and change it:
<? PHP
......
$ This-> totalpage = count ($ this-> splitfields );
}
// Obtain the total number of current pages
$ This-> fields ['totalpage'] = $ this-> totalpage;
$ This-> loadtemplet ();
$ This-> parsetempletsfirst ();
}
Note that the following code is added to obtain the total page number:
$ This-> fields ['totalpage'] = $ this-> totalpage;
2. Use Js in the template to analyze static and dynamic pages and flip pages down
Edit article_image.htm or the final template displayed in your gallery 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 = location. href;
Function gonextpic (){
Str1 =/\. html/ig;
Str2 =/_/ig;
R = curl. Search (str1 );
R1 = curl. Search (str2 );
If (r> 0 ){
If (npage = 1) filename = curl. substr (0, R );
Else filename = curl. substr (0, R1 );
If (npage = totalpage) {location. href = filename + ". html ";}< br> else {
location. href = filename + "_" + (npage + 1) + ". html ";
}< BR >}else {
If (npage = totalpage) {location. href = "view. PHP? Aid = {Dede: field name = 'id'/} ";}< br> else {
location. href =" view. php? Aid = {Dede: field name = 'id'/} & pageno = "+ (npage + 1 );
}< BR >}< br>
In this JS script, we define a method called gonextpic to switch to the next image.
3. Finally, modify the image output code and call the gonextpic method.
modify include/inc_channel_unit.php
to find "// All list or paging Gallery.
the modification is similar. (You need to modify the code several times ):
$ revalue = "
$ alt
\ r \ n ";
:
$ revalue = "
$ alt
";
the end. have fun!