Dedecms 5.7 Implementation Article click on the picture to go to the next page example

Source: Internet
Author: User
Tags comments

Dede article click on the image automatically into the next page of the method, before looking for a lot of code, found that are not very good, find this code today, pro-test feasible, so posted out to share with you:

modifying/include/arc.archives.class.php files

1. Find "Parse template, assign value to changes in content" Add the following code to the phrase above.

function Clickpicnext ($ismake =1, $aid,& $body)
{
Global $cfg _rewrite;
if ($this->nowpage!= $this->totalpage)
{
$lPage = $this->nowpage+1;
if ($ismake =0)
{
$body =preg_replace ("/<" (img| IMG) (. *) (src| SRC) =[\ "| ' |] {0,} ((. *) >)/isu "," Click on the picture to go to the next page <br/><a href= ' ". $this->namefirst." _ ". $lPage.". $this->shortname. "' > "." \${0} "." </a> ", $body);
}
Else
{
Used in cases where static pages are generated
$PageList = "<a href= '". $this->namefirst. " _ ". $lPage.". $this->shortname. "' > "." \${0} "." </a> ";
For dynamic page use, I use static here, so the following line of code comments, if you are a dynamic page, the above line of code comments, use the following line.
$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, look for "$this->fields[$this->splitpagefield] = $this->splitfields[$pageNo –1];", add the following code under this code:

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> ';" Under this code, add the following code:

$this->prenext[' imgnext '] = "<a href= ' $mlink ' > '." \${0} "." </a> ";
4, look for "$this->prenext[' next"] = "Next: No"; Under this code, add the following code:

$this->prenext[' imgnext '] = "\${0}";
5, find the following code:

else if ($gtype = = ' Next ')
{
$rs = $this->prenext[' Next '];
}
Add the following code below it:

else if ($gtype = = ' Imgnext ')
{
$rs = $this->prenext[' Imgnext '];
}
and then save. Regenerate the article!

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.