织梦CMS模板借助tag调用有关文章的课程

2021-10-10 作者:未知   |   浏览(
-->下面大伙来看看DEDE用tag调用有关文章的方法,很合适网站优化哦。也可以依据关键字+tag调用。
1.把下边代码保存到文章模版的适合地方


有关文章

    rn";if){$ids[] = $row['id']; 织梦CMS.com //处置一些特殊字段$row['info'] = $row['infos'] = cn_substr;$row['id'] =$row['id'];if{$row['arcrank'] = $row['corank'];}$row['filename'] = $row['arcurl'] = GetFileUrl;$row['typeurl'] = GetTypeUrl;if {$row['litpic'] = $GLOBALS['cfg_cmspath'].'/images/defaultpic.gif';}if && $GLOBALS['cfg_multi_site'] == 'Y'){$row['litpic'] = $GLOBALS['cfg_mainsite'].$row['litpic'];}$row['picname'] = $row['litpic'];$row['stime'] = GetDateMK;$row['typelink'] = "".$row['typename']."";$row['image'] = "".ereg_replace."'>";$row['imglink'] = "".$row['image'].""; DEDE好,好DEDE $row['fulltitle'] = $row['title'];$row['title'] = cn_substr;if $row['title'] = "".$row['title']."";if) $row['title'] = "".$row['title']."";$row['textlink'] = "".$row['title']."";$row['plusurl'] = $row['phpurl'] = $GLOBALS['cfg_phpurl'];$row['memberurl'] = $GLOBALS['cfg_memberurl'];$row['templeturl'] = $GLOBALS['cfg_templeturl'];if){foreach{ if=='array') {$dtp2->Assign;}else {if])) $dtp2->Assign]);else $dtp2->Assign;}}$GLOBALS['autoindex']++;}$artlist .= $dtp2->GetResult."rn";}//if hasRowelse{$artlist .= '';}if $artlist .= "


    {dede:likearticle col='2' row='10' titlelen='42' eregtype=all|tag|keyword} [field:title/]2.把下边的php代码替换掉likearticle.lib里的代码织梦CMS.comcopyright 织梦CMS$getsql = " tag like '".join."' ";$dsql->Execute;while) {$tids[] = $arow['id'];}$tid = join;if{$dsql->Execute And arcrank > -1 group by aid order by aid desc limit 0, $row");while){$ids[] = $arow['aid'];$arcid =$refObj->Fields['aid']; }}}if == 0 ){return '';}else{if > 0){if) {$typeid = " And arc.typeid in And arc.id<>$arcid ";}$idsStr = join;$query = "Select arc.*,tp.typedir,tp.typename,tp.corank,tp.isdefault,tp.defaultname,tp.namerule,tp.namerule2,tp.ispart,tp.moresite,tp.siteurl,tp.sitepathfrom `dedecp_archives` arc left join `dedecp_arctype` tp on arc.typeid=tp.idwhere arc.id in $typeid order by arc.id desc"; }else{$limitRow = $row - count;$keyword = '';if){$keywords = explode);$keyword = '';$n = 1;foreach{ifbreak;if=='') continue;else $k = addslashes;$keyword .=  like '%$k%' " : " OR CONCAT like '%$k%' ");$n++;}}$arcid =  ? $refObj->Fields['aid'] : 0); if || $byabs==0 ) {$orderquery = " order by arc.id desc "; }else {$orderquery = " order by ABS ";}if{if) {$typeid = " And arc.typeid in And arc.id<>$arcid ";}$query = "Select arc.*,tp.typedir,tp.typename,tp.corank,tp.isdefault,tp.defaultname,tp.namerule,tp.namerule2,tp.ispart,tp.moresite,tp.siteurl,tp.sitepathfrom `dedecp_archives` arc left join `dedecp_arctype` tp on arc.typeid=tp.idwhere arc.arcrank>-1 and $typeid $orderquery limit 0, $row"; }else{if) {$typeid = " arc.typeid in And arc.id<>$arcid ";}$query = "Select arc.*,tp.typedir,tp.typename,tp.corank,tp.isdefault,tp.defaultname,tp.namerule,tp.namerule2,tp.ispart,tp.moresite,tp.siteurl,tp.sitepathfrom `dedecp_archives` arc left join `dedecp_arctype` tp on arc.typeid=tp.idwhere arc.arcrank>-1 and$typeid $orderquery limit 0, $row";}}} $innertext = trim );if $innertext = GetSysTemplets;$dsql->SetQuery;$dsql->Execute;$artlist = '';if {$artlist = "rn";}$dtp2 = new DedeTagParse;$dtp2->SetNameSpace;$dtp2->LoadString;$GLOBALS['autoindex'] = 0;$line = $row;for{if $artlist .= "rn";for{if $artlist .= "rn";}//Loop Colif $i += $col - 1;if $artlist .= "rn"; }//loop lineif $artlist .= "rn";$dsql->FreeResult;return $artlist;}?>

      1.用于5.6、5.7的任何版本
      2.可以单用tag来调用有关文章,也可用tag+keyword来调用有关文章(默认tag优先于keyword,可以自己排序),很合适SEO,经测试成效最佳。