DZ触摸屏版 贴子列表页修改方法
模板文件位置/template/default/touch/forum/forumdisplay.htm
如果使用得不是默认模板,位置为/template/自定义模板名文件夹名/touch/forum/forumdisplay.htm
修改参看DZ数据表字典
discuz列表页调用帖子内容(正文)
实际使用下面实例时,去掉代码中双正斜杠“//”的注释内容。
DZ触摸屏版贴子列表页调用一张附件图片
如果有则调用,如果没有则不调用
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
{if $thread['attachment'] == 2} {eval $table='forum_attachment_'.substr($thread['tid'], -1);} {eval $thread['aid'] = DB::result_first("SELECT aid FROM ".DB::table($table)." WHERE tid='$thread[tid]' AND isimage!='0'");} {/if} //以下三种形式,前面必须有以上的几行代码,或者用自己的方法把它们结合到一起 //形式一 {if $thread['aid']} <img alt="" src="{eval echo(getforumimg($thread['aid'],1,120,120))}" /> {/if} //形式二 {if $thread['aid']} <img alt="" src="{eval echo(getforumimg($thread['aid']))}" /> {/if} //形式三 {if $thread['aid']} {eval $abc=getforumimg($thread['aid'])} <img src="$abc" alt="" /> {/if} |
DZ触摸屏版贴子列表页调用所有(多张)附件图片
0 1 2 3 4 5 6 |
{if $thread['attachment'] == 2} {eval $table='forum_attachment_'.substr($thread['tid'], -1);} {eval $thread['attachmentimg'] = DB::fetch_all("SELECT * FROM ".DB::table($table)." WHERE tid='$thread[tid]' AND isimage!='0'");} {loop $thread['attachmentimg'] $keyimg $valimg} <a class="attachmentimg attachmentimg_$i" href="data/attachment/forum/$valimg['attachment']"><img src="data/attachment/forum/$valimg['attachment']" /></a> {/loop} {/if} |
解释如下:
表pre_forum_thread中字段attachment,附件类型,0无附件 1普通附件 2有图片附件
{if $thread['attachment'] == 2} //如果此贴字段attachment等于2时
$table等于forum_attachment_2
查询数据表pre_forum_attachment_2得到$thread['aid']的新值(调用单张图片的实例中使用的)
查询数据表pre_forum_attachment_2得到数组$thread['attachmentimg']
循环输出数据$thread['attachmentimg']的键和值($keyimg和$valimg,都为数组)
数据表pre_forum_attachment_2中字段attachment即为图片附件路径
所以图片附件路径为$valimg['attachment']
注:DB::fetch_all很好的东东
DZ触摸屏版贴子列表页调用点击收藏
0 1 2 3 4 |
{if !IS_ROBOT && !$_G['forum_thread']['archiveid']} {if $post['invisible'] == 0} <a href="home.php?mod=spacecp&ac=favorite&type=thread&id=$thread[tid]&formhash={FORMHASH}" id="k_favorite" onclick="showWindow(this.id, this.href, 'get', 0);" title="{lang fav_thread}"><i><img src="{IMGDIR}/fav.gif" alt="{lang thread_favorite}" /><span id="favoritenumber">$thread['favtimes']</span></i></a> {/if} {/if} |
DZ触摸屏版贴子列表页调用点赞(顶、支持)
0 1 2 |
{if !empty($_G['setting']['recommendthread']['addtext'])} <a id="recommend_add" href="forum.php?mod=misc&action=recommend&do=add&tid=$thread['tid']&hash={FORMHASH}" {if $thread['tid']}onclick="ajaxmenu(this, 3000, 1, 0, '43', 'recommendupdate({$_G['group']['allowrecommend']})');return false;"{else} onclick="showWindow('login', this.href)"{/if}><i><img src="{IMGDIR}/rec_add.gif" alt="$_G['setting']['recommendthread'][addtext]" />$_G['setting']['recommendthread'][addtext]<span id="recommendv_add">$thread['recommend_add']</span></i></a> {/if} |
开启DZ顶踩功能的方法:网站后台>>全局>>站点功能>>主题评价>>启用议题评价是(是)
DZ触摸屏版贴子列表页点击分享、调用分享数
0 |
<a href="home.php?mod=spacecp&ac=share&type=thread&id=$thread[tid]" id="k_share" onclick="showWindow(this.id, this.href, 'get', 0);"><i><img src="{IMGDIR}/oshr.png" alt="{lang thread_share}" />{lang thread_share}<span id="sharenumber">{$thread['sharetimes']}</span></i></a> |
前提条件:开启QQ互联功能插件
此没有完全测试,但我感觉这个分享还是直接使用其它分享插件,如百度分享等
原创文章,转载请注明出处(http://mrdede.com/?p=662),谢谢!