Get the App
SLTechnology News&Howtos  ›  Servers  › 

How does the dedecms search page call the number of search results separately

Shulou Source: shulou.com Published: 2022-06-02 03:36:11 09月30日 Update

This article is about how the dedecms search page invokes the number of search results individually. The editor thought it was very practical, so I shared it with you as a reference. Let's follow the editor and have a look.

How does the dedecms search page call the number of search results separately?

The number of search results in DEDE is integrated into the list paging tab, and there is no separate function to provide this number of results, so there is a problem for users who have a separate number of search results to call, and here is a method for secondary development.

It's very simple, just change a few things:

The first step is to open the / include/arc.searchview.class.php file and look for the code (about line 525):

Else if ($tagname== "pagelist") {$list_len= trim ($ctag- > GetAtt ("listsize")); if ($list_len== ") {$list_len= 3;} $this- > dtp- > Assign ($tagid,$this- > GetPageListDM ($list_len));}

Add the code below:

Else if ($tagname== "itemcount") {$list_len= trim ($ctag- > GetAtt ("listsize")); if ($list_len== ") {$list_len= 3;} $this- > dtp- > Assign ($tagid,$this- > GetItemsCountDM ($list_len));}

The second step is to find the code (about line 925):

/ * get the url * * @ access public * @ return string * / of the current page file

Add the following code to it:

Function GetItemsCountDM ($list_len) {global $oldkeyword; $pagenow = ($this- > PageNo-1) * 10 + 1; $pagenows = $this- > PageNo*10; / / when the result exceeds the limit, reset the result pages if ($this- > TotalResult > $this- > SearchMaxRc) {$totalpage = ceil ($this- > SearchMaxRc/$this- > PageSize);} $plist. = $this- > TotalResult; return $plist;}

The third step is to call the following tag where you want to display the number of results in the search results page template:

{dede:itemcount listsize='4'/}

This allows individual calls to the number of search results for the search results page.

Thank you for reading! On the dedecms search page how to call the search results to share here, I hope the above content can be of some help to you, so that you can learn more knowledge. If you think the article is good, you can share it and let more people see it.

Tags: Results search search results pages code quantity content places files more tags good practical functions articles methods templates users see knowledge Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno vpn Microsoft Linux Huawei Shulou Information