Implementation of DEDECMS Atlas Click the function of the page-whole station program

Source: Internet
Author: User
Tags curl
1, in order to achieve this function, we first need to get the picture page of the current page number and total page number
Edit include/inc_archives_view.php File
(1) To find the function Parsedmfields, modified to:
function Parsedmfields ($pageNo, $ismake =1)
{
$this->nowpage = $pageNo;
Get 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 is added to get the current page number:
$this->fields[' cpagenum '] = $this->nowpage;
(2) Locate the function __construct constructor, modified to:
<?php
......
$this->totalpage = count ($this->splitfields);
}
Get current page Totals
$this->fields[' totalpage '] = $this->totalpage;
$this->loadtemplet ();
$this->parsetempletsfirst ();
}
Note that the following code is added to get the total page number:
$this->fields[' totalpage '] = $this->totalpage;
2, next in the template with JS implementation analysis of static and dynamic pages and PAGE down
Edit article_image.htm or your atlas to eventually display the template, adding 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";}
else{
Location.href = filename+ "_" + (npage+1) + ". html";
}
}else{
if (npage==totalpage) {location.href = "View.php?aid={dede:field name= ' id '/}";}
else{
Location.href = "View.php?aid={dede:field name= ' id '/}&pageno=" + (npage+1);
}
}
}
</script>
In this JS script, we define a method gonextpic to switch to the next picture.
3, finally modify the picture output code, complete Gonextpic method call
Modify include/inc_channel_unit.php
Locate the part of the//all list or page-view atlas.
Modify similar (look closely at the code, need to modify several places):
$revalue = "<center><a href= ' $src ' target= ' _blank ' ></a ><br/> $alt <br/></center>\r\n ";
For:
$revalue = "<center><a href= ' Javascript:gonextpic" (); ></a><br/> $alt <br/></center> ';
The end. Have fun!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.