PHPCMS SEO['title']样式修改

2012-11-12 浏览:1199
PHPCMS SEO['title']样式修改
评论:(0)复制地址

phpcms系统自带的SEOtitle代码是:<title>{if isset($SEO['title']) && !empty($SEO['title'])}{$SEO['title']}{/if}{$SEO['site_title']}</title>,但是显示出来的效果是:客户服务-商智网络科技有限公司。如何将“-”修改为下划线“_”?可以修改以下文件代码:

phpcms\libs\functions\global.func.php 1390行,注意红色部分!

 

/**
 * 生成SEO
 * @param $siteid       站点ID
 * @param $catid        栏目ID
 * @param $title        标题
 * @param $description  描述
 * @param $keyword      关键词
 */
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 : $site['keywords'];
 $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']) ? $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;
}

评论:(0)复制地址
发布:苗景云 | 分类:IT技术&设计 | Tags:PHPCMS

发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。