用织梦Dedecms系统建网站,有时会需要在子栏目显示上级栏目名称和栏目链接,就用到下面的代码了。
PHP='yes'} $tc="-"; //分隔符 $tw=$GLOBALS['cfg_list_symbol']; //调用位置分隔符 $tf=split($tw,@me); //分解成数组 $ta=1; $tk=trim($tf[$ta]); $tk=substr($tk,-2); @me=$tk; //赋值给@me {/dede:field}
方法1:
PHP='yes'} $tc="-"; //分隔符 $tw=$GLOBALS['cfg_list_symbol']; //调用位置分隔符 $tf=split($tw,@me); //分解成数组 $ta=(count($tf)-3); $tk=trim($tf[$ta]); @me=$tk; //赋值给@me {/dede:field}
方法2:
GetOne("SELECT reid FROM dede_arctype where id=@me"); $reid = $reid['reid']; $typename = $dsql->GetOne("SELECT typedir FROM dede_arctype where id=$reid"); @me=str_replace('{cmspath}','',$typename['typedir']); {/dede:field.typeid} > {dede:field.typeid runphp='yes'"} global $dsql ; $reid = $dsql->GetOne("SELECT reid FROM dede_arctype where id=@me"); $reid = $reid['reid']; $typename = $dsql->GetOne("SELECT typename FROM dede_arctype where id=$reid"); @me=$typename['typename']; {/dede:field.typeid}
调用指定栏目
{/dede:type}
DEDE标题栏:文章标题-2级栏目-1级栏目-网站名”样式显示
=1;$ta--){ //循环赋值给$tk $tk.=trim($tf[$ta]).$tc; } $tk=substr($tk,-1); @me=$tk; //赋值给@me {/dede:field}-{dede:global name='cfg_webname'/}