当前位置:首页 > 文章 > 帝国CMS > 正文内容

帝国cms网站标题关键词描述自动加密转换成乱码前台显示正常查看源码是乱码

3年前 (2022-10-22)帝国CMS7652

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-08-27

列表页:

<?
$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])?>" />

 

效果:

帝国cms网站标题关键词描述自动加密转换成乱码前台显示正常查看源码是乱码

扫描二维码推送至手机访问。

版权声明:本文由蓝博发布,如需转载请注明出处。

本文链接:https://www.blueboss.cn/p/663.shtml

“帝国cms网站标题关键词描述自动加密转换成乱码前台显示正常查看源码是乱码” 的相关文章

IIS环境下开启TAG伪静态帝国CMS的中文TAG提示此TAG不存在

IIS环境下开启TAG伪静态帝国CMS的中文TAG提示此TAG不存在

用帝国cms制作网站或者搬家后,IIS环境下开启TAG伪静态,帝国CMS的中文TAG提示此TAG不存在,是什么问题呢?解决方案: 打开/e/tags/index.php文件 查找: $tagname=RepPostVar($_GET['tagname']); 修改为 $tagname=RepPo...

帝国cms灵动标签同时调用头条和推荐

帝国cms灵动标签同时调用头条和推荐

帝国cms灵动标签同时调用头条(1级、2级)、推荐(1级、2级)方法1、同时调用头条(1级、2级)、推荐(1级、2级) [e:loop={0,10,3,0,'isgood=1 or firsttitle=1 orisgood=2 or firsttitle=2'}] <a href="<...

帝国CMS动态页支持栏目导航标签循环子栏目数据标签万能标签的调用

帝国CMS动态页支持栏目导航标签循环子栏目数据标签万能标签的调用

分享一种利用JS来实现支持栏目导航标签,万能标签,循环子栏目数据标签的方法。   第一步:在【模板】下面增加标签模板,标签模板内容如下:   页面模板内容(*): [!--empirenews.listtemp--]<!--list.var1-->[!--empirenews.list...

帝国cms搜索模板无缓存使用多个搜索模板

帝国cms搜索模板无缓存使用多个搜索模板

网站中用到两个甚至多个搜索模板,在搜索代码中除了会设置指定的模板id以外,还需要更改以下内容,目的就为了解决缓存问题,比如说,用户可能是在搜索“模板”图文列表后,再去搜“教程”,搜索列表显示的还是之前“模板”的搜索模板。提醒大家一定要先备份哟!教程如下: 将以下内容替换到/e/search/resu...

帝国CMS中#091;!--no.num--]标签的用法分析

帝国CMS中#091;!--no.num--]标签的用法分析

帝国CMS [!--no.num--] 标签用法: 帝国CMS[!--no.num--] 指定从某一数字开始显示 代码如下: <?=$bqno+5?> 帝国CMS[!--no.num--] 输出效果为 1 2 3 4 5 6 7 8...样式 代码如下: <?=$bqno?&g...

帝国CMS模板用灵动标签调用同级栏目导航并且当判断显示当前栏目高亮

帝国CMS模板用灵动标签调用同级栏目导航并且当判断显示当前栏目高亮

帝国cms模板里面怎么用灵动标签调用同级的栏目导航呢?同时判断显示当前栏目导航高亮! 调用代码:(注意:hover为判断当前高亮css样式) [e:loop={"select classname,classpath,classid from phome_enewsclass where bclas...