phpcms网页seo标题不显示解决方法

因为单页面是默认调用seo META Description的,所以现在弄一下调用seo META Title和seo META Keywords.
大家应该都是在header头文件里写上{if isset($SEO['title']) && !empty($SEO['title'])}{$SEO['title']}{/if}{$SEO['site_title']}这个的吧。

这个$SEO的变量是在/phpcms/modules/content/index.php里的。
所以要找到这个$SEO这个变量。
v9的代码写的很人性化。有注释标明那些是单页面的代码。
我直接找到单页面那个代码块。发现这里的$SEO变量如下:
$SEO = seo($siteid, 0, $title,$setting['meta_description'],$keywords);
seo这个函数所在文件/phpcms/libs/functions/global.func.php
这个函数的声明为:
function seo($siteid, $catid = '', $title = '', $description = '', $keyword = '') 
研究一下它的定义,发现第二个参数是调用栏目seo META Title和seo META Keywords使用的,如果是0就不调用。
修改方法。
将上面$SEO的赋值写成
$SEO = seo($siteid, $catid, $title,$setting['meta_description'],$keywords);
在网上查了一下,还要修改/phpcms/modules/content/class/html.class.php里面的单页面$SEO变量(这个应该是生成静态化用的。)。
找到有注释标明那些是单页面的代码一样修改为:
$SEO = seo($siteid, $catid, $title,$setting['meta_description'],$keywords);

关于标题有重复,可以修改一下seo META Title这样看起来会好看点。
还有标题后面多了一个杠。
我将seo这个函数所在文件/phpcms/libs/functions/global.func.php里面的
$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'] . ' - ' : ''));
修改成:
$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']: ''));
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值