Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Methods to solve the irrelevance of articles related to DEDECMS

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly introduces the methods to solve the irrelevance of DEDECMS-related articles, which has a certain reference value, friends who need can refer to it. I hope you will learn a lot after reading this article. Next, let the editor take you to learn about it.

What if the articles related to DEDECMS are not relevant?

The related articles of DEDE are completely irrelevant. It is also very good for a friend to show the relevant articles according to TAG in DEDE. unfortunately, after I change the DEDE code according to the article over there, it may be that the ability is limited, of course, there may be something wrong with the code.

Recommended study: dream weaving cms

Now there is finally a solution:

1 add before the last? > of inc_functions.php

/ / query articles with corresponding keywords in the specified column, and list / / parameter description: whether $showImg displays thumbnails, 0 means not, 1 indicates display / / $titleLen title length, 0 indicates infinite / / $rowCount output lines, 0 indicates infinite / / $typeid column ID,0 represents all columns / / $keyWord keywords, string function ShowKeyWordArc ($showImg,$titleLen,$rowCount,$typeid,$keyWord) {$dsql = new DedeSql (false) $sql = TypeGetSunID ($typeid,$dsql); / / keyword segmentation technology $ks = explode ("", $keyWord); foreach ($ks as $k) {$k = trim ($k); if ($kwsqlarr = ") {$kwsqlarr [] =" (xkzzz_archives.title like'% $k%') "; / / $kwsqlarr [] =" (xkzzz_archives.keywords like'% $k%') " / / if you need keywords related to other articles, uncomment this line} $where = implode ('OR', $kwsqlarr) $sql= "Select tp.namerule,tp.typedir,xkzzz_full_search.aid,xkzzz_full_search.url,xkzzz_archives.* From xkzzz_full_search left join xkzzz_archives on xkzzz_full_search.aid=xkzzz_archives.ID left join xkzzz_arctype tp on xkzzz_archives.typeid=tp.ID where {$sql} and ((xkzzz_archives.title like'%". $keyWord. "%') or $where) order by xkzzz_full_search.aid desc"; $dsql- > SetQuery ($sql); $dsql- > Execute (); $ss= ""; $iTun0 While ($row=$dsql- > GetObject ()) {$url=GetFileUrl ($row- > ID,$row- > typeid,$row- > senddate,$row- > title,$row- > ismake,$row- > arcrank,$row- > namerule,$row- > typedir,$row- > money); if ($showImg==0) {$ss=$ss. "; if ($titleLensenti0) $ss=$ss.cn_substr ($row- > title,$titleLen); else $ss=$ss.$row- > title; $ss=$ss.";} else {$ss=$ss. "; if ($row- > litpickets =") $ss=$ss. "

".$row-title."

"else $ss=$ss."

"; $ss=$ss."; if ($titleLenovo rowCount 0) $ss=$ss.cn_substr ($row- > title,$titleLen); else $ss=$ss.$row- > title; $ss=$ss. "";} $I; if ($rowCountCountCountCountCountCountCompany0) & & ($I > = $rowCount)) return $ss;} return $ss;}

2 put it in the article template page

{dede:field name='keywords' function='ShowKeyWordArc (0pr 32je 10je 0, "@ me")'/}

It means to take the relevant articles in all columns (related to the keywords of the current article). The maximum length of the title is 32, with a maximum of 10 items displayed, and no thumbnails are displayed.

Or

{dede:field name='keywords' function='ShowKeyWordArc (0pr 32, 10pm 0, "Senior three Chinese")'/}

You can find articles in the title that contain "Senior three Chinese" or "Senior three" or "Chinese".

For example, this paragraph:

Related articles {dede:likeart titlelen='24' row='10'} [field:textlink/]

< >

{/ dede:likeart}

Change it to:

Related articles {dede:field name='keywords' function='ShowKeyWordArc (0pc32, 10jin0, "@ me")'/}

Declare: I didn't write this function.

According to the keywords, the articles are very good in terms of user experience and SEO.

But the only bad thing is that it is much slower to generate static. Haha, the server has to work hard again.

Thank you for reading this article carefully. I hope the editor will share the methods to solve the irrelevance of DEDECMS-related articles. At the same time, I also hope that you will support us, pay attention to the industry information channel, and find out if you encounter problems. Detailed solutions are waiting for you to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report