织梦园模板网提供云优cms模板,pbootcms模板,Wordpress主题模板等各类企业新闻资讯网站模板下载服务。织梦园网站模板交流群
用户名:
密码:
注册
注册后享受折扣价

有seotitle的时候显示seotitle没有则显示默认标题

织梦园模板 / 2019-05-28 / 收藏

dedecms栏目标题seo:有seotitle的时候显示seotitle没有则显示默认标题

<title>{dede:field name=’typeid’ runphp=’yes’}
$id=@me;
global $dsql;
$sql=”select * from dedecode_com_arctype where id=$id”;
$row=$dsql->getOne($sql);
$seotitle=$row["seotitle"];
$typename=$row["typename"];
$topid=$row["topid"];
if($seotitle!==”){
@me=$seotitle;

}else{
$sql2=”select * from dedecode_com_arctype where id=$topid”;
$row2=$dsql->getOne($sql2);
$typename2=$row2["typename"];
@me=$typename2.”-”.$typename;
}

{/dede:field}- {dede:global name=’cfg_webname’/}</title>

将以上代码替换默认的标题 就可以了。这样标题更加实用,方便了栏目过多,有一些栏目没有必要单独写SEOtitle。

相关织梦技巧

收缩