帝国CMS灵动标签显示标题属性、截取标题字数

2020-06-09 15:30:20 来源:互联网作者:佚名 人气: 次阅读 585 条评论

帝国cms采用灵动标签时,我们一般用<?=$bqr[title]?>输出标题,如下所示:[e:loop={"select title,titleurl from xjb_ecms_dzkb where `classid` = '$GLOBALS[navclassid]' order...

帝国cms采用灵动标签时,我们一般用<?=$bqr[title]?>输出标题,如下所示:

[e:loop={"select title,titleurl from xjb_ecms_dzkb where `classid` = '$GLOBALS[navclassid]' order by newstime",1,24,0}]
<li><a href="<?=$bqr[titleurl]?>"><?=$bqr[title]?></a></li>
[/e:loop]

一,帝国cms灵动标签截取标题字数的方法:

将上面的<?=$bqr[title]?>换成<?=esub($bqr[title],30)?>,这里面的30代表字节数,也就是显示15个汉字

二,帝国cms灵动标签显示标题属性的方法:

1,在SQL语句中,将titlefont字段也要选取出来:select titlefont,title,titleurl from......

2,将上面的<?=$bqr[title]?>换成<?=DoTitleFont($bqr[titlefont],$bqr[title])?>

三,帝国cms灵动标签又要显示标题属性,又要截取标题字数的方法:

将一、二方法综合一下,将<?=$bqr[title]?>换成<?=DoTitleFont($bqr[titlefont],esub($bqr[title],30))?>

您可能感兴趣的文章

相关文章