dede调用DZ论坛帖子及特定板块帖子的调用方法
论坛最新主题:
{dede:loop table="cdb_threads" sort="tid" row="10″} <a rel="nofollow noopener noreferrer" href="/dz/viewthread.php?tid=[field:tid /]"> ·[field:subject function="cn_substr('@me',30)" /]([field:lastpost function="date('m-d H:M','@me')" /]) </a> <br/> {/dede:loop} |
{dede:loop table="cdb_threads" if="fid=5 and displayorder!=-1″ sort="tid" row="10″} <a rel="nofollow noopener noreferrer" href="/dz/viewthread.php?tid=[field:tid /]"> ·[field:subject function="cn_substr('@me',30)" /]([field:lastpost function="date('m-d H:M','@me')" /])</a> {/dede:loop} |
显示精华帖:
{dede:loop table="cdb_threads" if="fid=5 AND digest>0 and displayorder!=-1 " sort="tid" row="10″} <a rel="nofollow noopener noreferrer" href="/dz/viewthread.php?tid=[field:tid /]"> ·[field:subject function="cn_substr('@me',30)" /]([field:lastpost function="date('m-d H:M','@me')" /])</a> {/dede:loop} |
论坛之星/活跃会员:
{dede:loop table="cdb_members" sort="posts" row="3″} <LI> <A rel="nofollow noopener noreferrer" href="/bbs/space.php?uid=[field:uid /]"><IMG src="/bbs/uc_server/avatar.php?uid=[field:uid /]&size=middle"></A> <A rel="nofollow noopener noreferrer" href="/bbs/space.php?uid=[field:uid /]">[field:username/]</A> <BR>贴子:[field:posts/] <BR>加入:[field:regdate function="GetDateMK(@me)"/] </LI> {/dede:loop} |
/bbs/space.php?uid=[field:uid /] 个人信息地址 /bbs/uc_server/avatar.php?uid=[field:uid /]&size=middle 论坛头像 /home/space.php?uid=[field:uid /] UCHOME的个人空间地址 |
调用贴子:
{dede:loop table="cdb_threads" if='digest>0′ sort="tid" row="10″} <LI><A rel="nofollow noopener noreferrer" href="/bbs/viewthread.php?tid=[field:tid /]">[field:subject function="cn_substr('@me',30)" /]</A> {/dede:loop} |
if="" 条件
示例1:调用版块ID为4的贴子:
if="fid=4″ 调用指定版块的贴子
示例2:调用版块ID为4的精华贴子
if="fid=4 AND digest>0″
示例3:调用回复超过20贴的贴子
if="fid=4 AND replies>20″
调用附件带图片的贴子
{dede:sql sql="SELECT` cdb_attachments`.`aid`, `cdb_attachments`.`attachment`, `cdb_threads`.`tid`, `cdb_threads`.`fid`, `cdb_threads`.`subject` FROM `cdb_attachments` LEFT JOIN `cdb_threads` ON `cdb_threads`.`tid`=`cdb_attachments`.`tid` WHERE `cdb_attachments`.`readperm`='0′ AND `displayorder`>='0′ AND `filetype`=' image/pjpeg' GROUP BY tid LIMIT 0,2″} <li><A rel="nofollow noopener noreferrer" href="/bbs/viewthread.php?tid=[field:tid /]"><IMG src=" /bbs/attachments/[field:attachment/]"></A></li> <li><A rel="nofollow noopener noreferrer" href="/bbs/viewthread.php?tid=[field:tid /]">[field:subject function= "cn_substr('@me',30)" /]</A></li> {/dede:sql} |
本文织梦模板DEDECMS对discuz论坛的一些常用调用代码到此结束。有价值的人不是你摆平多少人,而是看你能帮助多少人。小编再次感谢大家对我们的支持!