GetKeywordSql.." and save it."/> GetKeywordSql.." and save it.">
search
HomeCMS TutorialDEDECMSWhat should I do if dede5.7 free list cannot obtain multiple keywords?

What should I do if dede5.7 free list cannot obtain multiple keywords?

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.

What should I do if dede5.7 free list cannot obtain multiple keywords?

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

What should I do if dede5.7 free list cannot obtain multiple keywords?

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 &#39;%$k%&#39; ";
        }
        if(!isset($kwsqls[0]))
        {
            return &#39;&#39;;
        }
        else
        {
            $kwsql = join(&#39; OR &#39;,$kwsqls);
            return $kwsql;
        }
    }
    /**
     *  获得关键字SQL,统计记录使用
     *
     * @access    private
     * @return    string
     */
    function GetRowSql($keyword)
    {
        $ks = explode(&#39;,&#39;,$keyword);
        $kwsql = &#39;&#39;;
        $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 &#39;%$k%&#39; ";
        }
        if(!isset($kwsqls[0]))
        {
            return &#39;&#39;;
        }
        else
        {
            $kwsql = join(&#39; OR &#39;,$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:

What should I do if dede5.7 free list cannot obtain multiple keywords?

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!

Statement
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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version

VSCode Windows 64-bit Download

VSCode Windows 64-bit Download

A free and powerful IDE editor launched by Microsoft

MinGW - Minimalist GNU for Windows

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.

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

DVWA

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