Zhimeng CMS secondary development tutorial to implement the pagination style of gallery thumbnails

Source: Internet
Author: User

First of all, the CMS system does not need to be introduced too much. It's a good dream!

Ghost (this is only 5.7 text-and-text magic light style ). Recently, when I was working on the gallery template mentioned by a woman, I found that the default gallery template of dede could not achieve the paging style like the document. I have repeatedly asked du Niang and Gu Ge for no results, therefore, I carefully studied the dream weaving file and found that the dream can achieve this style (for example ). Now I will share my ideas with you, which is also the most popular focus on the weimeng forum!

  

 

Problem Analysis:

To implement this paging method, you must call the thumbnail address when paging, but open the tab file and check that there is no thumbnail data. What should we do. We can only create a function dedicated to gallery paging calls through secondary development. If you want to change {dede: pagebreak/}, problems may occur in the paging method of the article. Therefore, we recommend that you create a function to avoid other problems.

Solution:

Step 1: Open arc_archives_class.php and add the following code at the end of the include directory:

/**
* Obtain the thumbnail list of images in the dynamic page Gallery.
*
* @ Access public
* @ Param int $ total number of pages in totalPage
* @ Param int $ nowPage current page number
* @ Param int $ aid Document id
* @ Return string
*/
Function GetlitpicDM_list ($ totalPage, $ nowPage, $ aid)
{
Global $ dsql, $ sqlCt;
$ Attlist = "desclen | 80 ";
FillAttsDefault ($ ctag-> cattriems-> Items, $ attlist );
Extract ($ ctag-> cattriact-> Items, EXTR_SKIP );
If (! Isset ($ this-> addTableRow ['imgurls']) return;
$ Revalue = '';
$ Dtp = new DedeTagParse ();
$ Dtp-> LoadSource ($ this-> addTableRow ['imgurls']);
$ Images = array ();
If (is_array ($ dtp-> CTags ))
{
$ Pagenum = 1;
Foreach ($ dtp-> CTags as $ ctag1)
{
If ($ ctag1-> GetName () = "img ")
{
$ Litpic. = '<LI>
<DIV class = img> <A title = "'. $ ctag1-> GetAtt ('text ').'"
Href = "view. php? Aid = '. $ aid.' & pageno = '. $ pagenum.' "> Style = "BACKGROUND-IMAGE: url ('. $ ctag1-> GetAtt ('ddimg ').')"
Src = "'. $ GLOBALS ['cfg _ templets_skin']. '/tukustyle/blankBg.gif"> </A> </DIV> <
Href = "view. php? Aid = '. $ aid. '& pageno = '. $ pagenum. '"> '. substr ($ ctag1-> GetAtt ('text'), 30 ). '</A> </LI> ';

$ Pagenum ++;
}
}
}

Return $ litpic;
}
/**
* Obtain the thumbnail list of images in the static page Gallery.
*
* @ Access public
* @ Param int $ total number of pages in totalPage
* @ Param int $ nowPage current page number
* @ Param int $ aid Document id
* @ Return string
*/
Function Getlitpic_list ($ totalPage, $ nowPage, $ aid)
{
Global $ dsql, $ sqlCt;
$ Attlist = "desclen | 80 ";
FillAttsDefault ($ ctag-> cattriems-> Items, $ attlist );
Extract ($ ctag-> cattriact-> Items, EXTR_SKIP );
If (! Isset ($ this-> addTableRow ['imgurls']) return;
$ Revalue = '';
$ Dtp = new DedeTagParse ();
$ Dtp-> LoadSource ($ this-> addTableRow ['imgurls']);
$ Images = array ();
If (is_array ($ dtp-> CTags ))
{
$ Pagenum = 1;
Foreach ($ dtp-> CTags as $ ctag1)
{
If ($ ctag1-> GetName () = "img ")
{
If ($ pagenum = 1)
{
$ Litpic. = '<LI>
<DIV class = img> <A title = "'. $ ctag1-> GetAtt ('text ').'"
Href = "'. $ this-> NameFirst.'. '. $ this-> ShortName.'"> Style = "BACKGROUND-IMAGE: url ('. $ ctag1-> GetAtt ('ddimg ').')"
Src = "'. $ GLOBALS ['cfg _ templets_skin']. '/tukustyle/blankBg.gif"> </A> </DIV> <
Href = "'. $ this-> NameFirst. '_'. $ pagenum. '. '. $ this-> ShortName. '"> '. substr ($ ctag1-> GetAtt ('text'), 0, 30 ). '</A> </LI> ';
}
Else
{
$ Litpic. = '<LI>
<DIV class = img> <A title = "'. $ ctag1-> GetAtt ('text ').'"
Href = "'. $ this-> NameFirst.' _ '. $ pagenum.'. '. $ this-> ShortName.'"> Style = "BACKGROUND-IMAGE: url ('. $ ctag1-> GetAtt ('ddimg ').')"
Src = "'. $ GLOBALS ['cfg _ templets_skin']. '/tukustyle/blankBg.gif"> </A> </DIV> <
Href = "'. $ this-> NameFirst. '_'. $ pagenum. '. '. $ this-> ShortName. '"> '. substr ($ ctag1-> GetAtt ('text'), 0, 30 ). '</A> </LI> ';
}
$ Pagenum ++;
}
}
}

Return $ litpic;
}

Finally, the template is called. This is not detailed. Of course, this is just a method! This article is the first webmaster website. If a woman says the original content, please indicate the source for reprinting. Like a friend can go to a woman to see the actual effect of http://tuku.nvsay.com

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.