代理加盟 2020全新代理计划 赚钱+省钱双管齐下,独立平台,丰厚利润!

您现在的位置: 秀站网 > 织梦大学 > 使用教程 >

DedeCMS标签likearticle调用全站相关文章支持排序

来源:本站原创 发布时间:2019-03-30 00:00:00热度:我要评论(0

免费下载,无需注册无需充值

       DedeCMS一个SEO优化重要标签likearticle,根据标题、关键字调用本栏目下的相似文章。这意味着为某文章增加了许多带“长尾关键词”的文章,内容相关度增强,为网站增加PV。缺点是不能调用全站相似文章,不支持order by排序属性,做如下修改:

likearticle全站调用相似文章

       打开/include/taglib/likearticle.lib.php,找到

$typeid = " And arc.typeid in($typeid) And arc.id<>$arcid ";

       修改为

$typeid = " And arc.id<>$arcid ";

likearticle支持order by排序

       继续找到

extract($ctag->CAttribute->Items, EXTR_SKIP);
$revalue = ";

       下面添加

$orderby=$ctag->GetAtt('orderby');

       找到

if( empty($arcid) || $byabs==0 ) {
$orderquery = " order by arc.id desc ";
}
else {
$orderquery = " order by ABS(arc.id – ".$arcid.") ";
}

       修改为

$orderquery = ";
if($orderby=='hot' || $orderby=='click') $orderquery = " order by arc.click $orderWay";
else if($orderby == 'sortrank' || $orderby=='pubdate') $orderquery = " order by arc.sortrank $orderWay";
else if($orderby == 'id') $orderquery = " order by arc.id $orderWay";
else if($orderby == 'near') $orderquery = " order by ABS(arc.id – ".$arcid.")";
else if($orderby == 'lastpost') $orderquery = " order by arc.lastpost $orderWay";
else if($orderby == 'scores') $orderquery = " order by arc.scores $orderWay";
else if($orderby == 'rand') $orderquery = " order by rand()";
else if($orderby == 'weight') $orderquery = " order by arc.weight asc";//如果没有特定设置排序则按照权重先排序
else $orderquery = " order by arc.sortrank $orderWay";

转载请注明来源网址:https://www.xiuzhanwang.com/dedecms_jq/1386.html

    发表评论

    评论列表(条)