In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
This article shares information on how to solve problems unrelated to DEDECMS documentation. Xiao Bian thinks it is quite practical, so share it for everyone to make a reference. Let's follow the editor and have a look.
What if DEDECMS related documents are irrelevant?
DEDE related articles are completely irrelevant, there are friends in DEDE official release according to TAG show related articles, is also very good, unfortunately I change the DEDE code according to the article there is always not good, may be limited ability, of course, there may be code problems
Recommended Learning: Weaving Dreams CMS
And now there's a solution.
1 Last in inc_functions.php?> added before
//Query the articles with corresponding keywords in the specified column and list them //Parameter description: $showImg Whether to display thumbnail image, 0 means not to display, 1 means to display // $titleLen title length, 0 means infinite // $rowCount Output rows, 0 means infinite // $typeid Column ID, 0 indicates all columns // $keyWord keyword, 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[] = " (dede_archives.title like '%$k%') "; //$kwsqlarr[] = " (dede_archives.keywords like '%$k %')"; //Uncomment this line if you need keywords related to other articles } } $where = implode(' OR ',$kwsqlarr); $sql="Select tp.namerule,tp.typedir,dede_full_search.aid,dede_full_search.url,dede_archives.* From dede_full_search left join dede_archives on dede_full_search.aid=dede_archives.ID left join dede_arctype tp on dede_archives.typeid=tp.ID where {$sql} and ((dede_archives.title like '%".$ keyWord. "%') or $where) order by dede_full_search.aid desc"; $dsql->SetQuery($sql); $dsql->Execute(); $ss=""; $i=0; 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 ($titleLen!= 0) $ss=$ss.cn_substr($row->title,$titleLen); else $ss=$ss.$ row->title; $ss=$ss. ""; }else{ $ss=$ss. ""; if ($row->litpic!= "") $ss=$ss. "
"; else $ss=$ss. "
"; $ss=$ss. ""; if ($titleLen!= 0) $ss=$ss.cn_substr($row->title,$titleLen); else $ss=$ss.$ row->title; $ss=$ss. ""; } $i ; if (($rowCount!= 0)&&($i>=$rowCount)) return $ss; } return $ss; }
2 in the article template page
{dede:field name='keywords' function='ShowKeyWordArc(0,32,10,0,"@me")'/}
It means that all relevant articles in the column (related to the keywords of the current article) are selected. The maximum length of the title is 32, and the maximum number of displayed is 10. No thumbnail images are displayed.
or
{dede:field name='keywords' function='ShowKeyWordArc(0,32,10,0,"Senior Chinese")'/}
You can find articles with titles 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(0,32,10,0,"@me")'/}
Note: I did not write this function.
Related articles based on keywords are very good in terms of user experience and SEO
Thank you for reading! About how to solve the DEDECMS related documents irrelevant problems to share here, I hope the above content can be of some help to everyone, so that everyone can learn more knowledge. If you think the article is good, you can share it so that more people can see it!
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.