1、在e/class/userfun.php里添加自定义函数
首页模板调用方式:
- 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])?>" />
内容页:
- <?php
- $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])?>" />