首页 > 移动平台 > 详细

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

时间:2019-09-15 09:33:39      阅读:185      评论:0      收藏:0      [点我收藏+]

   因网友要求,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‘, ‘...‘));

  

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

原文:https://www.cnblogs.com/68xi/p/11521076.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!