dede5.7 Free list cannot obtain multiple keywords?
This article has compiled a complete solution to the problem of dede5.7 free list not being able to obtain multiple keywords, as well as alternative usage techniques. Friends in need can learn from it.
Recommended learning: 梦Weavercms
Let’s first take a look at the interface for adding a free list in DEDE5.7.
We can see in the picture that under normal circumstances, DEDE officially writes that multiple keywords can be used: keyword 1, keyword 2, keyword 3... , but I don’t know if it is an official mistake or for other reasons. After adding multiple keywords, it has no effect. Instead, no content can be retrieved. Based on the problems reported by everyone, we have compiled a complete solution to this problem. method.
Involved files: Replace include\arc.freelist.class.php
We can see that the involved code is as shown in the picture above.
Let’s hide the two codes first!
We will write a related statement ourselves:
$orwhere .= "AND (".$this->GetKeywordSql($keyword)." )";
Finally, we will find the location below and add the relevant search conditions and rules we wrote
function GetKeywordSql($keyword) { $ks = explode(',',$keyword); $kwsql = ''; $kwsqls = array(); foreach($ks as $k) { $k = trim($k); if(strlen($k)<1) { continue; } if(ord($k[0])>0x80 && strlen($k)<2) { continue; } $k = addslashes($k); $kwsqls[] = " arc.title LIKE '%$k%' "; } if(!isset($kwsqls[0])) { return ''; } else { $kwsql = join(' OR ',$kwsqls); return $kwsql; } } /** * 获得关键字SQL,统计记录使用 * * @access private * @return string */ function GetRowSql($keyword) { $ks = explode(',',$keyword); $kwsql = ''; $kwsqls = array(); foreach($ks as $k) { $k = trim($k); if(strlen($k)<1) { continue; } if(ord($k[0])>0x80 && strlen($k)<2) { continue; } $k = addslashes($k); $kwsqls[] = " title LIKE '%$k%' "; } if(!isset($kwsqls[0])) { return ''; } else { $kwsql = join(' OR ',$kwsqls); return $kwsql; }
Add the above code to the bottom of the page, and now the multiple keyword function of DEDE's free list can be used!
It’s not over yet! The editor encountered a problem during the actual testing process. We added two keywords. Is that to allow further filtering, or to add broader keywords? This problem has troubled me for a long time. Through the above code, I tested the relevant solution:
We can see that in this place, if we use "OR" means or, that is, we say that the scope of the search is expanded, so that articles with keywords that appear will appear. If we change to "AND", it means narrowing the scope of the search, indicating that there are already key words in the article. Word 1 must also have keyword 2.
The above is the detailed content of What should I do if dede5.7 free list cannot obtain multiple keywords?. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.
