Home> CMS Tutorial> DEDECMS> body text

What should I do if DEDECMS related documents are not relevant?

藏色散人
Release: 2019-12-12 10:15:04
Original
1865 people have browsed it

What should I do if DEDECMS related documents are not relevant?

What should I do if the DEDECMS related documents are not relevant?

DEDE related articles are completely irrelevant. I have friends in DEDE The official release of related articles based on TAG is also very good. Unfortunately, after I change the DEDE code based on the article there, it always fails. It may be due to limited ability, of course, there may also be a problem with the code

Recommended study:伟梦cms

Now we finally have a solution

1. Add

 //查询指定栏目里包含相应关键字的文章,并列出      //参数说明:$showImg 是否显示缩略图,0表示不显示,1表示显示      // $titleLen 标题长度,0表示无限      // $rowCount 输出行数,0表示无限      // $typeid 栏目ID,0表示所有栏目      // $keyWord 关键字,字符串      function ShowKeyWordArc($showImg,$titleLen,$rowCount,$typeid,$keyWord){      $dsql = new DedeSql(false);      $sql = TypeGetSunID($typeid,$dsql);      //关键字分词技术      $ks = explode(" ",$keyWord);      foreach($ks as $k){      $k = trim($k);      if ($k!="") {      $kwsqlarr[] = " (dede_archives.title like '%$k%') ";      //$kwsqlarr[] = " (dede_archives.keywords like '%$k%') "; //如果需要相关到其它文章的关键字,解除此行注释      }      }      $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."litpic."' alt='".$row->title."' />";      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;      }
    Copy after login

    at the end of inc_functions.php?> 2. Place it on the article template page Inside

      {dede:field name=’keywords’ function=’ShowKeyWordArc(0,32,10,0,”@me”)’/}
    Copy after login

    means that relevant articles in all columns (related to the keywords of the current article) are fetched. The maximum title length is 32, and a maximum of 10 items are displayed. Thumbnails are not displayed

    or

      {dede:field name=’keywords’ function=’ShowKeyWordArc(0,32,10,0,”高三语文”)’/}
    Copy after login

    You can find articles that contain "High School Chinese" in the title, or contain "High School" or "Chinese"

    For example, this paragraph:

    Related articles

      {dede:likeart titlelen=’24′ row=’10′}      [field:textlink/]< >      {/dede:likeart}
    Copy after login

    Change it to:

    Related articles

      {dede:field name=’keywords’ function=’ShowKeyWordArc(0,32,10,0,”@me”)’/}
    Copy after login

    Disclaimer: This function was not written by me

    Related articles based on keywords, user experience and SEO They say they are all very good

    The above is the detailed content of What should I do if DEDECMS related documents are not relevant?. For more information, please follow other related articles on the PHP Chinese website!

    Related labels:
    source:php.cn
    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
    Latest Downloads
    More>
    Web Effects
    Website Source Code
    Website Materials
    Front End Template
    About us Disclaimer Sitemap
    php.cn:Public welfare online PHP training,Help PHP learners grow quickly!