V9默认的,当你某栏目填写了SEO信息之后,会继承到下级未添加SEO信息的栏目和内容。非常的烦人。
修改步骤:
打开:根目录/phpcms/libs/functions/global.func.php
找到 function seo(约1435行)
将原来的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;
新闻热点
疑难解答