声明一个扩展变量
我命名的是 appid 记得写入缓存
调用:<?=$public_r['add_appid']?>
如果需要在网页显示关注按钮的话 添加一个代码就可以
【注意】这个代码需添加在<body>之后
<script>cambrian.render('head')</script>
下面是我目前使用的熊掌号代码
下列代码添加在</head>之前
首页代码
- <link rel="canonical" href="[!--news.url--]"/>
- <script src="//msite.baidu.com/sdk/c.js?appid=<?=$public_r['add_appid']?>"></script>
- <script type="application/ld+json"> {
- "@context": "https://zhanzhang.baidu.com/contexts/cambrian.jsonld",
- "@id": "[!--news.url--]",
- "appid": "<?=$public_r['add_appid']?>",
- "title":"[!--pagetitle--]",
- "images": [
- "https://www.pc07.com/images/xzhlogo.png"
- ],
- "description": "[!--pagedes--]",
- "pubDate": "<?=date("Y-m-d")?>T<?=date("H:i:s")?>",
- "isOriginal": "0"
- }</script>
栏目页代码
- <link rel="canonical" href="<?=sys_ReturnBqClassUrl($class_r[$GLOBALS[navclassid]]);?>"/>
- <script src="//msite.baidu.com/sdk/c.js?appid=<?=$public_r['add_appid']?>"></script>
- <script type="application/ld+json"> {
- "@context": "https://zhanzhang.baidu.com/contexts/cambrian.jsonld",
- "@id": "<?=sys_ReturnBqClassUrl($class_r[$GLOBALS[navclassid]]);?>",
- "appid": "<?=$public_r['add_appid']?>",
- "title":"<?php $cr=$empire->fetch1("select bname from phome_enewsclass where classid='".$GLOBALS[navclassid]."' limit 1"); echo $cr['bname']; ?>",
- "images": [
- "[!--class.classimg--]"
- ],
- "description": "[!--pagedes--]",
- "pubDate": "<?=date("Y-m-d")?>T<?=date("H:i:s")?>",
- "isOriginal": "0"
- }</script>
内容页代码
- <link rel="canonical" href="[!--titleurl--]"/>
- <script src="//msite.baidu.com/sdk/c.js?appid=<?=$public_r['add_appid']?>"></script>
- <script type="application/ld+json">{
- "@context": "https://zhanzhang.baidu.com/contexts/cambrian.jsonld",
- "@id": "[!--titleurl--]",
- "appid": "<?=$public_r['add_appid']?>",
- "title":"[!--pagetitle--]",
- "images": [
- <?php
- if($navinfor[titlepic])
- {
- ?>
- "[!--titlepic--]"
- <?
- }
- else
- {
- ?>
- "https://www.pc07.com/images/xzhlogo.png"
- <?
- }
- ?>
- ],
- "description": "[!--smalltext--]",
- "pubDate": "<?php
- $t=time();
- echo str_replace('CS','',date("Y-m-dTH:i:s",$t));
- ?>",
- "isOriginal": "1"}
- </script>