Home CMS Tutorial DEDECMS What 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?

Dec 16, 2019 am 10:23 AM
dede

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)." )";
Copy after login

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;
        }
Copy after login

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 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

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

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
1 months ago By 尊渡假赌尊渡假赌尊渡假赌
Two Point Museum: All Exhibits And Where To Find Them
1 months ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)