星联网络专注帝国CMS二次功能插件开发-精品网站模板站长代码素材

  • 最近更新
  • 模板:33
  • 记录:12640|
  • 插件:52|
  • 工具:4|
  • 代码:8|
  • 评论:0

帝国cms模板改造加熊掌号推送代码包含首页列表页和内容页

前言

给帝国cms模板加熊掌号推送代码比如首页模板、列表页模板和内容页模板代码。只需要复制对应的代码即可完成改造。以下代码加入到head标签中。首页代码:

给帝国cms模板加熊掌号推送代码比如首页模板、列表页模板和内容页模板代码。只需要复制对应的代码即可完成改造。

以下代码加入到head标签中。

首页代码:
  1. <link rel="canonical" href="[!--news.url--]" />
  2.     <script src="//msite.baidu.com/sdk/c.js?appid=自己的熊掌id"></script>
  3.     <script type="application/ld+json">
  4.         {
  5.             "@context": "https://ziyuan.baidu.com/contexts/cambrian.jsonld",
  6.             "@id": "[!--news.url--]",
  7.             "appid": "自己的熊掌id",
  8.             "title": "[!--pagetitle--]",
  9.             "images": [
  10.                 "https://网站的LOGO地址/logo.png",
  11.                 "",
  12.                 ""
  13.             ],
  14.             "description": "[!--pagedes--]",
  15.             "pubDate": "<?=date('Y-m-d')?>T<?=date('H:i:s')?>",
  16.             "isOriginal": "1"
  17.         }
  18.     </script>
列表页代码(多图的):
  1.    <link rel="canonical" href="[!--titleurl--]" />
  2.     <script src="//msite.baidu.com/sdk/c.js?appid=自己的熊掌id"></script>
  3.     <script type="application/ld+json">
  4.         {
  5.             "@context": "https://ziyuan.baidu.com/contexts/cambrian.jsonld",
  6.             "@id": "[!--titleurl--]",
  7.             "appid": "自己的熊掌id",
  8.             "title": "[!--pagetitle--]",
  9.             "images": [
  10.                 "<?=$navinfor[titlepic]?>",
  11.                 "<?=$_img[0][1]?>",
  12.                 "<?=$_img[0][2]?>"
  13.             ],
  14.             "description": "[!--smalltext--]",
  15.             "pubDate": "<?=date('Y-m-d',$navinfor[newstime])?>T<?=date('H:i:s',$navinfor[newstime])?>",
  16.             "isOriginal": "1"
  17.         }
  18.     </script>
下面这段代码放模板顶部用于提取图片:
 
  1. <?php
  2. $_class=$empire->fetch1("select * from {$dbtbpre}enewsclass where classid='$GLOBALS[navclassid]'");
  3. $_classimg = "https://img.kaituozu.com/img/logo.png";
  4. if (empty($_class[classimg])) {$_class[classimg] = $_classimg;}
  5. ?>
内容页单个图的代码:
  1.    
  2.   <link rel="canonical" href="[!--titleurl--]" />
  3.   <script src="//msite.baidu.com/sdk/c.js?appid=自己的熊掌id"></script>
  4. <script type="application/ld+json">
  5.         {
  6.             "@context": "https://ziyuan.baidu.com/contexts/cambrian.jsonld",
  7.             "@id": "[!--titleurl--]",
  8.             "appid": "自己的熊掌id",
  9.             "title": "[!--pagetitle--]",
  10.             "images": [
  11.                 "<?=$navinfor[titlepic]?>",
  12.                 "",
  13.                 ""
  14.             ],
  15.             "description": "[!--smalltext--]",
  16.             "pubDate": "<?=date('Y-m-d',$navinfor[newstime])?>T<?=date('H:i:s',$navinfor[newstime])?>",
  17.             "isOriginal": "1"
  18.         }
  19.     </script>
以下代码放到模板顶部用于提取图片,当没图片的时候用缩略图代替
 
  1. <?php
  2. $_titlepic = "https://logo图片地址/logo.png";
  3. if (empty($navinfor[titlepic])) {$navinfor[titlepic] = $_titlepic;}
  4. ?>
上面代码都是放在head标签里面,除了底下面声明的要放到模板顶部。

内容页可以根据自己实际使用情况在模板中加入。

 

本网刊登的文章均仅代表作者个人观点,并不代表本网立场。文中的论述和观点,敬请读者注意判断。

本文地址:http://www.xlkjgs.com/notes/ecms/s15663.html

以上内容由本站整理呈现,请务必在转载分享时注明本文地址!如对内容有疑问,请联系我们,谢谢!

星联网络

星联网络是中国最具实战的互联网创业者的知识服务商,这里有互联网行业动态,网络推广,SEO优化,SEM优化,ESC配置,行业经验分型,互联网项目,微信营销、淘宝客赚钱、新媒体营销、京东运营、跨境电商等众多互联网营销知识分享

站长运营站长必备网站运营之道才能长久发展