About the correct method of ZBLOG homepage filtering a classified article and reconstructing paging

skill 3 years ago Lao Li next door Last edited on 2022-03-28 11:01:06

Recently, you need to add a homepage article list to filter some categories for a topic

So I searched and found that all the methods on the Internet were wrong or incomplete

This is why the title of this article is used [Correct] The reason for this word

So far, all the methods of not displaying the designated classified articles on the homepage of the Internet are reprinted Tu Tu Yan's articles

The method is as follows:

Hanging interface:

 Add_Filter_Plugin('Filter_Plugin_ViewList_Core','everbox_articles_xs');

Function Body:

 function everbox_articles_xs(&$type,&$page,&$category,&$author,&$datetime,&$tag,&$w,&$pagebar){ global $zbp; 	 if($type == 'index'){ $w[]=array('<>','log_CateID',27); //The following is to rebuild the paging, filter the classification, and the quantity will change $pagebar = new Pagebar($zbp->option['ZC_INDEX_REGEX']); $pagebar->PageCount = $zbp->displaycount; $pagebar->PageNow = $page; $pagebar->PageBarCount = $zbp->pagebarcount; }	 }

Note: 27 above refers to the ID of the category you do not want to display.

However, this method is wrong!

Although this method achieves the filtering effect, there will be no redundant error paging, but the first page link will make an error

For example, after this blog is set according to the above method, the URL of the first page becomes https://* */page.html, and the correct link of the first page is https://***/

So I consulted Tu Tu Yan in the development group, and the reason for the error was that he wrote two less true words at the beginning!

However, all kinds of reproducers on the Internet directly copy and paste without any verification, which leads to all the results searched are wrong!!!

The correct function is as follows:

 function everbox_articles_xs(&$type,&$page,&$category,&$author,&$datetime,&$tag,&$w,&$pagebar){ global $zbp; 	 if($type == 'index'){ $w[]=array('<>','log_CateID',27); //The following is to rebuild the paging, filter the classification, and the quantity will change $pagebar = new Pagebar($zbp->option['ZC_INDEX_REGEX'], true, true); $pagebar->PageCount = $zbp->displaycount; $pagebar->PageNow = $page; $pagebar->PageBarCount = $zbp->pagebarcount; }	 }

Finally, it suddenly occurred to me that rumors may also cause adverse consequences due to unverified forwarding.

Is it true that human nature is a repeater?!

 About the correct way to filter a classified article and rebuild paging on ZBLOG homepage Page 1

This article is written by@ Lao Li next door Issued on July 8, 2021 at Yeluzi Blog , unless otherwise specified, all articles in this blog are original, please retain the source for reprinting.
comment (0)
 visitor
Top