实现DedeCms文章标题分栏显示

2023/06/12 08:26    5G收录网    已浏览101次

代码如下:
01 {dede:field name='title'/}-{dede:field name='position' runphp='yes'}
02 $tc="-"; //分隔符
03 $tw=$GLOBALS['cfg_list_symbol']; //调用位置分隔符
04 @me=html2text(@me); //去除html标签
05 $tf=split($tw,@me); //分解成数组
06 for($ta=(count($tf)-2);$ta>=1;$ta--){ //循环赋值给$tk
07 $tk.=trim($tf[$ta]).$tc;
08 }
09 $tk=substr($tk,0,-1);
10 @me=$tk; //赋值给@me
11 {/dede:field}-{dede:global name='cfg_webname'/}
将以上代码放在之间就可以实现“文章标题-2级栏目-1级栏目-网站名”的形式