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;
}
相关文章
PHPCMS 统计栏目下子栏目数量的代码2024-11-12
PHPCMS V9 上传图片或附件后后台退出需要重新登录的解决办法2021-06-19
PHPCMS 推荐位输出组图的方法2020-12-30
PHPCMS内容页自定义下拉菜单循环输出数值的方法2020-12-17
PHPCMS v9 search模块搜索栏目名称二次开发2020-02-20
PHPCMS删除文章后数据库中仍有删除文章中的关键词解决办法2019-11-13
PHPCMS中TAG模板、COMMENT模板等不能使用{SITEURL($SITEID)}函数2019-11-13
PHPCMS V9编辑器中新增上传mp4视频(上传视频并插入HTML5的video标签)的功能2019-10-30
PHPCMS一些漏洞修复及解决方案2019-07-10
PHPCMS的产品筛选功能(通用)2019-04-09