內(nèi)容頁調(diào)用SEO標(biāo)題:在<title></title>之間加入以下代碼:
{dede:field name='typeid' runphp='yes'}
$id=@me;
global $dsql;
$sql="select seotitle from dede_arctype where id=$id";
$row=$dsql->getOne($sql);
@me=$row["seotitle"];
{/dede:field}
內(nèi)容頁調(diào)用欄目描述:
把默認(rèn)的
<meta name="description" content="{dede:field.description function='html2text(@me)'/}" />
改成:
<meta name="description" content="{dede:field name='typeid' runphp='yes'}
$id=@me;
global $dsql;
$sql="select description from dede_arctype where id=$id";
$row=$dsql->getOne($sql);
@me=$row["description"];
{/dede:field}" />
內(nèi)容頁調(diào)用欄目關(guān)鍵字:
把默認(rèn)的
<meta name="keywords" content="{dede:field.keywords/}" />
改成:
<meta name="keywords" content="{dede:field name='typeid' runphp='yes'}
$id=@me;
global $dsql;
$sql="select keywords from dede_arctype where id=$id";
$row=$dsql->getOne($sql);
@me=$row["keywords"];
{/dede:field}" />
調(diào)取欄目頁標(biāo)題
{dede:field name='title'/}-{dede:field name='position' runphp='yes'}
$tc="-"; //分隔符
$tw=$GLOBALS['cfg_list_symbol']; //調(diào)用位置分隔符
@me=html2text(@me); //去除html標(biāo)簽
$tf=split($tw,@me); //分解成數(shù)組
for($ta=(count($tf)-2);$ta>=1;$ta--){ //循環(huán)賦值給$tk
$tk.=trim($tf[$ta]).$tc;
}
$tk=substr($tk,0,-1);
@me=$tk; //賦值給@me
{/dede:field}-{dede:global name='cfg_webname'/}
將以上代碼放在之間就可以實(shí)現(xiàn)“文章標(biāo)題-2級欄目-1級欄目-網(wǎng)站名”的形式了
最近研究cms內(nèi)容管理系統(tǒng)的二次開發(fā),發(fā)布一些自己的心得和經(jīng)驗(yàn),和大家一起交流學(xué)習(xí)!