Skip to content

Instantly share code, notes, and snippets.

@sarices
Created August 2, 2013 06:16
Show Gist options
  • Save sarices/6137834 to your computer and use it in GitHub Desktop.
Save sarices/6137834 to your computer and use it in GitHub Desktop.
dedecms 自动标题 无关键字和介绍时使用网站公共的数据
<title>{dede:php}
$typeid = intval($refObj->Fields['typeid']);
$aid = intval($refObj->Fields['aid']);
if($aid>0) echo $refObj->Fields['title'].' - ';
if($typeid>0) echo $refObj->Fields['typename'].' - ';
{/dede:php}{dede:global.cfg_webname/}</title>
{dede:field.keywords runphp='yes'}
//自动匹配是否有值,无值使用系统配置的值
$k = @me;
if($k=="")
{
@me = "<meta name='keywords' content='".$GLOBALS["cfg_keywords"]."'/>";
}
else
{
@me = "<meta name='keywords' content='".$k."'/>";
}
{/dede:field.keywords}
{dede:field.description runphp='yes'}
//自动匹配是否有值,无值使用系统配置的值
$k = @me;
if($k=="")
{
@me = "<meta name='description' content='".$GLOBALS["cfg_description"]."'/>";
}
else
{
@me = "<meta name='description' content='".$k."'/>";
}
{/dede:field.description}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment