修复wecenter移动版description首页描述一样问题

   因网友要求,wecenter移动版description首页描述一样,所以在此写个教程,希望帮助大家!

  

修改方法

打开app/m/main.php

TPL::output('m/question');

  

在这行代码前面添加

TPL::set_meta('keywords', implode(',', $this->model('system')->analysis_keyword($question_info['question_content'])));
TPL::set_meta('description', $question_info['question_content'] . ' - ' . cjk_substr(str_replace("\r\n", ' ', strip_tags($question_info['question_detail'])), 0, 128, 'UTF-8', '...'));

  

修复文章描述

 

TPL::output('m/article');

  在这行代码前面添加

  

TPL::set_meta('keywords', implode(',', $this->model('system')->analysis_keyword($article_info['title'])));
TPL::set_meta('description', $article_info['title'] . ' - ' . cjk_substr(str_replace("\r\n", ' ', strip_tags($article_info['message'])), 0, 128, 'UTF-8', '...'));

  

修复话题描述

 

TPL::output('m/topic');

  在这行代码前面添加

$related_topics_ids = array();
        $page_keywords[] = $topic_info['topic_title'];
        if ($related_topics = $this->model('topic')->related_topics($topic_info['topic_id']))
        {
            foreach ($related_topics AS $key => $val)
            {
                $related_topics_ids[$val['topic_id']] = $val['topic_id'];
                $page_keywords[] = $val['topic_title'];
            }
        }
        TPL::set_meta('keywords', implode(',', $page_keywords));
        TPL::set_meta('description', cjk_substr(str_replace("\r\n", ' ', strip_tags($topic_info['topic_description'])), 0, 128, 'UTF-8', '...'));

  

转载于:https://www.cnblogs.com/68xi/p/11521076.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值