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

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。