In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
Editor to share with you to solve the problem of dede:arclist keyword, I believe that most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to understand it!
How to solve {dede:arclist keyword=' dynamic keyword acquisition'}?
Solve {dede:arclist keyword=' dynamic keyword acquisition'}
Recommended study: dream weaving cms
Recently modified the template, in order to make the relevant articles more relevant, I intend to optimize it, but it will increase the time to generate the page. It is good if it is not updated frequently.
Recently, I am doing a station, and I want to do a function, that is, there is a div block showing the title of the article with the same keywords as the current article. It was written like this at the beginning.
{dede:arclist keyword=' {dede:field name='keyword'}'} the result is definitely not allowed. I couldn't find it on the Internet. So I read the code and wrote a simple one.
On line 149 of arclist.lib.php
The code is as follows:
/ / keyword condition if ($keyword conditional conditions')
Change the content in the middle of {}
{$rowGetKeyword = $dsql- > GetOne ("select keywords From `dede_ Archives` where id='$arcid'"); $keyword=$rowGetKeyword ['keywords']; $keyword= str_replace (',','|', $keyword); $orwheres [] = "CONCAT (arc.title,arc.keywords) REGEXP'$keyword'";}
In this way, you can directly call {dede:arclist keyword=' to write anything here as long as it is not empty'} so that the keyword here can be obtained dynamically. Otherwise, it can only be fixed.
Just before I posted it, I saw a tag in dede5.6.
{dede:likeart titlelen='' row=''} {/ dede:likeart}
This tag hasn't been tested yet, but that should be the feature. If not, everyone will use the method I mentioned above. It has been tested and can be used.
Keyword related revision methods for DEDECMS related articles
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.
Now there is finally a solution:
1 add before the last? > of inc_functions.php
The code is as follows:
/ / 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 ($k = ") {$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 ($titleLeniness0) $ss=$ss.cn_substr ($row- > title,$titleLen); else $ss=$ss.$row- > title; $ss=$ss.";} else {$ss=$ss. ""
If ($row- > litpicures = "") $ss=$ss. "
"else $ss=$ss."
"; $ss=$ss."; if ($titleLeninghouse 0) $ss=$ss.cn_substr ($row- > title,$titleLen); else $ss=$ss.$row- > title; $ss=$ss. "";} $iComplete; if ($rowCountCountCountCountCountCounting room0) & & ($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 (0Jing 32 Jing 10 Jing 0, "Senior three Chinese")'/} you can find articles with "Senior three Chinese" or "Senior three Chinese" in the title.
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.
The above is all the content to solve the problem of dede:arclist keyword, thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.