Dede Click on the image to go to the next page method (article)

Source: Internet
Author: User
Dede article click on the image to automatically go to the next page of the method, I see a lot of friends want, as if the Forum no one out of the way.
Today I need this function, so try to get a bit, the method is as follows:

Modify include/arc.archives.class.php

1. Find the "//parse template, assign a value to the changes in the content" add the following code to this paragraph:


function Clickpicnext ($ismake =1, $aid,& $body)
{
Global $cfg _rewrite;
if ($this->nowpage!= $this->totalpage)
{
$lPage = $this->nowpage+1;
if ($ismake ==1)
{
$body =preg_replace ("/< (img| IMG) (. *) (src| SRC) =[\ "|" | {0,} ((. *) >)/isu "," click on the image to go to the next page <br/><a href= ' ". $this->namefirst." _ ". $lPage.". $this->shortname. "' > "." \${0} "." </a> ", $body);
}
Else
{

Static page

$PageList = "<a href=". $this->namefirst. " _ ". $lPage.". $this->shortname. "' > "." \${0} "." </a> ";

Dynamic page
$PageList = "<a href= ' view.php?aid= $aid &pageno= $lPage ' >". \${0} "." </a> ";
if ($cfg _rewrite = = ' Y ')
{
$PageList = Str_replace (". php?aid=", "-", $PageList);
$PageList = Preg_replace ("/&pageno= (\d+)/i", '-\\1.html ', $PageList);
}
$body =preg_replace ("/< (img| IMG) (. *) (src| SRC) =[\ "|" | {0,} ((. *) >)/isu ", $PageList, $body);
}

}
Else
{

$body =preg_replace ("/< (img| IMG) (. *) (src| SRC) =[\ "|" | {0,} ((. *) >)/isu ", $this->getprenext (' Imgnext '), $body);
}


return $body;
}



2, find $this->fields[$this->splitpagefield] = $this->splitfields[$pageNo-1]; Add the following under it



if ($ClickPicNext) {
$this->fields[$this->splitpagefield]= $this->fields[$this->splitpagefield];
}else{
$this->fields[$this->splitpagefield]= $this->clickpicnext ($ismake, $this->fields[' id '), $this fields[$this->splitpagefield]);
}



3, find $this->prenext[' next ' = "Next: <a href= ' $mlink ' >{$nextRow [' title ']}</a> ';


$this->prenext[' imgnext ') = "<a href= ' $mlink ' >". " \${0} "." </a> ";


4, find $this->prenext[' next ' = "Next: none"; add below it


$this->prenext[' imgnext '] = "\${0}";

5. Find

else if ($gtype = = ' Next ')
{
$rs = $this->prenext[' Next ';
}


Add the following under it



else if ($gtype = = ' Imgnext ')
{
$rs = $this->prenext[' Imgnext ');
}

Related Article

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.