首页 > CMS > Discuz > 正文

discuz 帖内调用作者所有带封面帖子

2024-09-11 09:05:23
字体:
来源:转载
供稿:网友
目录 帖内调用作者所有带封面帖子,可在viewthread.htm中使用。         
<div class="uc-piclist">            <!--{eval $theuid = $_G[forum_thread][authorid]}-->            <!--{eval $authorthreads = DB::fetch_all("SELECT * FROM ".DB::table('forum_thread')." WHERE `authorid`= '$theuid' AND `cover`!=0 ORDER by dateline DESC LIMIT 0,9;");}-->            <ul>                <!--{loop $authorthreads $authorthread}-->                <!--{eval $threadcover = DB::result(DB::query("SELECT attachment FROM ".DB::table('forum_threadimage')." WHERE `tid`= '$authorthread[tid]'"));}-->                <!--{eval $threadfname = DB::result(DB::query("SELECT name FROM ".DB::table('forum_forum')." WHERE `fid`= '$authorthread[fid]'"));}-->                <li>                    <div class="uc-piclist-con-top">                        <div class="uc-thumb">                            <a href="forum.php?mod=viewthread&tid={$authorthread['tid']}" onclick="atarget(this)" title="$authorthread[subject] by admin" class="z">                            <img src="http://file.cmsbj.cn/cmsbj_file/forum/$threadcover" alt="$authorthread[subject] by $authorthread[author]" width="265" height="auto">                            </a>                        </div>                        <div class="uc-title">                            <a href="forum.php?mod=viewthread&tid={$authorthread['tid']}" onclick="atarget(this)" title="$authorthread[subject] by $authorthread[author]" class="uc-title-a"><span>$authorthread[subject]</span></a>                            <div class="uc-title-bg"></div>                        </div>                    </div>                    <div class="uc-piclist-con-bot">                        <div class="uc-stat">                            <span title="查看"><i class="ico-eye-open ico-gray"></i>$authorthread[views]</span>                            <span title="回复"><i class="ico-comment ico-gray"></i>$authorthread[replies]</span>                            <span title="喜欢"><i class="ico-heart ico-gray"></i>$authorthread[favtimes]</span>                            <!--{if $authorthread[digest] > 0}--><span title="精华"><font color=red>精华</font></span><!--{/if}-->                        </div>                        <div class="uc-author">                            <span><!--{echo dgmdate($authorthread[dateline], 'u', '9999', getglobal('setting/dateformat'))}--></span>                            <a href="forum.php?mod=forumdisplay&fid={$authorthread[fid]}" class="uc-forumname" title="TA发表在<!--{$threadfname}-->"><!--{$threadfname}--></a>                        </div>                    </div>                </li>                <!--{/loop}-->            </ul>            <div class="morethreads cl pgbtn"><a href="home.php?mod=space&uid=$authorthread[authorid]" hidefocus="true">去看更多...</a></div>        </div>
根据帖子作者uid查询帖子,再用获取到的tid查询帖子封面表获取封面。 图片路径是远程附件路径,本服务器的换成data/attachment/forum/$threadcover 也可缩略图显示,loop中加入<!--{eval $imagelistkeys = getforumimg($threadcover, 0, 265, 0); }-->。
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表