帝国cms灵动标签调用discuz图文帖子加简介的方法
[e:loop={"select tid,subject,dateline,digest from dy.pre_forum_thread where digest!=0 order by tid desc limit 4",10,24,0}]
<?php
$fr=$empire->fetch1("select attachment from dy.pre_forum_threadimage where tid='$bqr[tid]'");
$frb=$empire->fetch1("select tid,subject,dateline,fid,message from dy.pre_forum_post where tid='$bqr[tid]'");
$message=user_ubbAllstring($frb['message']);
$img="bbs/data/attachment/forum/".$fr[attachment]."";
?>
<li><span><?=date('Y-m-d',$bqr[dateline])?></span><a href="bbs/thread-<?=$bqr[tid]?>-1-1.html" target="_blank"><?=$bqr[subject]?></a>
<a class="mod-pic" href="bbs/thread-<?=$bqr[tid]?>-1-1.html" target="_blank"><img width="110" height="83" src="<?=$img?>"></a>
<?=esub($message,60,'...')?>
</li>
[/e:loop]
注意 这个 $bqr['message']=user_ubbAllstring($bqr['message']); 是来过滤discuz的UBB代码的
这个函数 你自己加在userfun.php里面
具体函数代码是
<?php
//---------------------------用户自定义标签函数文件
function user_ubbAllstring($thread){
$thread = preg_replace(
array('/&(#d{3,5};)/', "/[hide=?d*](.*?)[/hide]/is", "/[/?w+=?.*?]/"),
array('&\1','<b>**** Hidden Message *****</b>',''),
str_replace(
array('&', '"', '<', '>', "t", ' ', ' '),
array('&', '"', '<', '>', ' ', ' ', ' '),$thread));
return $thread;
}
?>