Home > Backend Development > PHP Tutorial > Implementation of fuzzy search in uhome and repair of paging bug_PHP tutorial

Implementation of fuzzy search in uhome and repair of paging bug_PHP tutorial

WBOY
Release: 2016-07-13 10:57:31
Original
1194 people have browsed it

This article will introduce to you in detail some specific methods of implementing fuzzy search and fixing paging bugs in uhome. Friends who need to know more can refer to this article to set up.

In the default uchome, the search for friends cannot be fuzzy search. For some reason, some people cannot remember the full name of a friend and cannot find the friend through the search. This is very bad for the user experience.

After research and changing the following code, the fuzzy search function of uhome can be realized.

Find the following code in the cp_friend.php file in the source and modify the statement in $wherearr[] as follows:

 代码如下 复制代码
 
if($searchkey = stripsearchkey($_GET['searchkey'])) {
            $wherearr[] = "(s.name like '%"."$searchkey"."%' OR s.username like '%"."$searchkey"."%')";
        } else {
            foreach (array('uid','username','name','videostatus','avatar') as $value) {
                if($_GET[$value]) {
                    $wherearr[] = "s.$value='{$_GET[$value]}'";
                }
            }
}

Fixing of search paging bug

During use, I found that if user search for ucenter takes more time to search, the paging in the list is wrong. Both ucenter1.5 and 1.6 have this error. I don’t know why the official does not solve this problem. After research, the solution is as follows:
Open user.php under control/admin
Find the code

The code is as follows
 代码如下 复制代码

$multipage = $this->page($num, UC_PPP, $_GET['page'], ‘admin.php?m=user&a=ls&srchname=’.$srchname.’&srchregdate=’.$srchregdate);

Copy code

 代码如下 复制代码

$multipage = $this->page($num, UC_PPP, $_GET['page'], ‘admin.php?m=user&a=ls&srchname=’.$srchname.’&srchregdatestart=’.$srchregdatestart.’&srchregdateend=’.$srchregdateend);

$multipage = $this->page($num, UC_PPP, $_GET['page'], 'admin.php?m=user&a=ls&srchname='.$srchname.'&srchregdate='.$srchregdate) ;

Change it to
The code is as follows

Copy code
$multipage = $this->page($num, UC_PPP, $_GET['page'], 'admin.php?m=user&a=ls&srchname='.$srchname.'&srchregdatestart='.$srchregdatestart. '&srchregdateend='.$srchregdateend); The repair is completed. http://www.bkjia.com/PHPjc/632087.html
www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/632087.htmlTechArticleThis article will introduce to you in detail some specific methods for implementing fuzzy search and repairing paging bugs in uhome. , friends who need to know can refer to this article to set it up. By default...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template