《CMS教程:更改V9 SEO函数 $SEO['title'] $SEO['keyword'] $SEO['description']》要点:
本文介绍了CMS教程:更改V9 SEO函数 $SEO['title'] $SEO['keyword'] $SEO['description'],希望对您有用。如果有疑问,可以联系我们。
导读:V9默认的,当你某栏目填写了SEO信息之后,会继承到下级未添加SEO信息的栏目和内容.非常的烦人.修改步骤:打开:根目录/phpcms/libs/funct...
V9默认的,当你某栏目填写了SEO信息之后,会继承到下级未添加SEO信息的栏目和内容.非常的烦人.
修改步骤:
打开:根目录/phpcms/libs/functions/global.func.php
找到 function seo(约1435行)
CMS技巧将原来的SEO函数替换为
function seo($siteid, $catid = '', $title = '', $description = '', $keyword = '') {
if (!empty($title))$title = strip_tags($title);
if (!empty($description)) $description = strip_tags($description);
if (!empty($keyword)) $keyword = str_replace(' ', ',', strip_tags($keyword));
$sites = getcache('sitelist', 'commons');
$site = $sites[$siteid];
$cat = array();
if (!empty($catid)) {
$siteids = getcache('category_content','commons');
$siteid = $siteids[$catid];
$categorys = getcache('category_content_'.$siteid,'commons');
$cat = $categorys[$catid];
$cat['setting'] = string2array($cat['setting']);
}
$seo['site_title'] =isset($site['site_title']) && !empty($site['site_title']) ? $site['site_title'] : $site['name'];
$seo['keyword'] = !empty($keyword) ? $keyword : '';
$seo['description'] = isset($description) && !empty($description) ? $description : (isset($cat['setting']['meta_description']) && !empty($cat['setting']['meta_description']) ? $cat['setting']['meta_description'] : (isset($site['description']) && !empty($site['description']) ? '' : ''));
$seo['title'] = (isset($title) && !empty($title) ? $title.' - ' : '').(isset($cat['setting']['meta_title']) && !empty($cat['setting']['meta_title']) ? $cat['setting']['meta_title'].' - ' : (isset($cat['catname']) && !empty($cat['catname']) ? $cat['catname'].' - ' : ''));
foreach ($seo as $k=>$v) {
$seo[$k] = str_replace(array("\n","\r"),'', $v);
}
return $seo;
转载请注明本页网址:
http://www.vephp.com/jiaocheng/6027.html