dedecms5.7 判断seo标题是否为空

dedecms5.7 判断seo标题是否为空,如果为空时,则自动调用栏目名称

{dede:field name='id' runphp='yes'}
$tid=@me;
$dsql = $db = new DedeSql(false);
$sql='select seotitle from dede_arctype where id='.$tid;
$arr = $db->GetOne($sql);
$seotitle=$arr['seotitle'];
if($seotitle=="")
{
$sql='select typename from dede_arctype where id='.$tid;
$arr = $db->GetOne($sql);
@me=$arr['typename'];
}
else
{
@me=$seotitle;
}
{/dede:field}

你可能感兴趣的:(dedecms)