1、在e/class/userfun.php里添加自定义函数 error_reporting(E_ERROR); function unicode_encode($str){preg_match_all(\'/./u\',$str,$matches);$unicodeStr = \"\";foreach(

1、在e/class/userfun.php里添加自定义函数

error_reporting(E_ERROR); 
function unicode_encode($str){
	preg_match_all('/./u',$str,$matches);
	$unicodeStr = "";
	foreach($matches[0] as $m){
		//拼接
		$unicodeStr .= "&#".base_convert(bin2hex(iconv('UTF-8',"UCS-4",$m)),16,10).';';
	}
	$end = strrpos($unicodeStr, '#')+6;
	$unicodeStr = substr($unicodeStr, 0, $end);
	return $unicodeStr.';';
}

首页模板调用方式:

<title><?=unicode_encode($public_r[sitename])?></title>
[e:loop={'select siteintro,sitekey from [!db.pre!]enewspublic',1,24,0}]
<meta name="keywords" content="<?=unicode_encode($bqr[sitekey])?>" />
<meta name="description" content="<?=unicode_encode($bqr[siteintro])?>" />
火车头采集发布到帝国cms后为未(待)审核状态设置教程详解

1、在e/class/userfun.php里添加自定义函数 error_reporting(E_ERROR…

推荐 2022-11-26

列表页:

<?
$classid=$GLOBALS[navclassid];
$cinfo=$empire->fetch1("select classname,classpagekey,intro from {$dbtbpre}enewsclass where classid = $classid");
?>
<title><?=unicode_encode($cinfo[classname])?> - <?=unicode_encode($public_r[sitename])?></title>
<meta name="keywords" content="<?=unicode_encode($cinfo[classpagekey])?>" />
<meta name="description" content="<?=unicode_encode($cinfo[intro])?> " />

内容页:

<title><?=unicode_encode($navinfor[title])?> - <?=unicode_encode($public_r[sitename])?></title>
<meta name="keywords" content="<?=unicode_encode($navinfor[keyboard])?>" />
<meta name="description" content="<?=unicode_encode($navinfor[smalltext])?>" />

 

效果:

温馨提示:本文最后更新于 2022-08-26 23:59 ,某些文章具有时效性,若有错误或已失效,请在下方留言或联系QQ115904045
声明:
1.本站大部分内容均收集于网络!若内容若侵犯到您的权益,请发送邮件至:[email protected],我们将第一时间处理!
2.资源所需价格并非资源售卖价格,是收集、整理、编辑详情以及本站运营的适当补贴,并且本站不提供任何免费技术支持
3.所有资源仅限于参考和学习,版权归原作者所有,更多请阅读网站声明

给TA打赏
共{{data.count}}人
人已打赏
帝国CMS教程

帝国cms使用灵动标签实现当前栏目高亮的方法

2022-8-26 11:58:21

帝国CMS教程

帝国cms非首页调用网站关键词和描述的方法

2022-8-27 0:01:38

  • 0 条回复 A文章作者 M管理员
      暂无讨论,说说你的看法吧
    购物车
    优惠劵
    今日签到
    有新私信 私信列表
    搜索

    夕阳无别事,等风也等你

    联系我们