欢迎来到素材无忧网,按 + 收藏我们
登录 注册 退出 找回密码

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

时间: 2019-05-24 11:57 阅读: 作者:素材无忧网

目录 帖内调用作者所有带封面帖子,可在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); }-->。

版权声明: 本站资源均来自互联网或会员发布,如果侵犯了您的权益请与我们联系,我们将在24小时内删除!谢谢!

转载请注明: discuz 帖内调用作者所有带封面帖子

标签:  
相关文章
模板推荐