代码分析之:viewthead.htm篇
前些天..和大家一起分析了forumdisplay.htm模板代码,详细可以看这个帖子:http://www.discuz.net/thread-459921-1-1.html,
其中涉及的变量,大家可以参考M55等人收录总结出来的变量列表:http://www.discuz.net/thread-329110-1-1.html
,
大家不要一味上来就要求要这个,要那个..浪费时间不说.除去好心人提供的一些东西外,也得不到什么,这也是导致DISCUZ现在论坛的风气不好的一个 主要原因..我觉得,以前那个相互学习的氛围没有了..所以说..大家还是最好还是扎扎实实的学些东西.从很基本的开始做起,好比喻说..细心看看我写的 这几篇东东,虽然是很表面的东西,可是,又有多少人认真去看了呢?
或者,看慬了,又有多少人耐着性子,拿出来和大家一起分享了呢?
还是那一句,我写的这些东西,主要是面对新手..好像我这样,想学东西,但又什么都不慬的,就给点精神,细细的看完..但如果是高手,笑笑过就算了..
宗旨:
很多人说要看viewthead.htm的.好..现在VIEWTHEAD的..也写上来了..
还是和上次一样(分析用的是default下的viewthead.htm模板...顺序是从上到下...一段一段的解释..其中与forumdisplay.htm中调用相同的模块的,就只是标出,不详细介绍了..
好下面正式开始..
...火星人都知道了吧...
好了..下面开始的就是帖子主体的内容了..包括左边的头像信息啊..右边的帖子信息啊..之类的..休息一下,大家一努力一起看下去..
下面这段是帖子标题的那一个TABLE的分析..
<form method="post" name="delpost" action="topicadmin.php?action=delpost&fid=$fid&tid=$tid&page=$page">
<input type="hidden" name="formhash" value="{FORMHASH}">
<!--{loop $postlist $post}-->
<div class="spaceborder" style="width: {TABLEWIDTH}; margin-bottom: 4px;<!--{if $post['first']}--> border-top: none<!--{/if}-->">
<table cellspacing="{INNERBORDERWIDTH}" cellpadding="{TABLESPACE}" width="100%" align="center" class="t_row">
<tr style="height: 100%">
<td width="18%" valign="top" class="t_user">$post[newpostanchor] $post[lastpostanchor]
<!--{if $forum['ismoderator']}-->
<!--{if $allowviewip}--><a href="topicadmin.php?action=getip&fid=$fid&tid=$tid&pid=$post[pid]"><img src="{IMGDIR}/ip.gif" border="0" align="right" alt="{lang admin_getip}" /></a><!--{/if}-->
<!--{/if}-->
<!--{if $post['authorid'] && $post['username'] && !$post['anonymous']}-->
<a href="viewpro.php?uid=$post[authorid]" target="_blank" class="bold">$post[author]</a><!--{if $post['nickname']}--> <span class="smalltxt">($post[nickname])</span><!--{/if}-->
<br><div class="smalltxt">
$post[authortitle]
<br>{eval showstars($post['stars']);}<br><!--{if $post['customstatus']}-->$post[customstatus]<br><!--{/if}--><br>
<!--{if $avatarshowpos == 3 && $post['avatarshow'] && $showavatars}-->
<center>$post[avatarshow]</center><br>
<!--{elseif $post['avatar'] && $showavatars}-->
<table width="95%" border="0" cellspacing="0" cellpadding="0" style="table-layout: fixed; overflow: hidden">
<tr><td align="center">$post[avatar]</td></tr></table><br>
<!--{else}-->
<br><br>
<!--{/if}-->
<!--{if $post['medals']}-->
<!--{loop $post['medals'] $medal}-->
<img src="images/common/$medal[image]" border="0" alt="$medal[name]" />
<!--{/loop}-->
<br>
<!--{/if}-->
{lang uid} $post[uid]<br>
{lang digest_posts} <!--{if $post['digestposts']}--><a href="digest.php?authorid=$post[authorid]">$post[digestposts]</a><!--{else}-->$post[digestposts]<!--{/if}--><br>
{lang credits} $post[credits]<br>
{lang posts} $post[posts]<br>
<!--{loop $extcredits_thread $key $credit}-->
$credit[title] $post[$key] $credit[unit]<br>
<!--{/loop}-->
{lang readperm} $post[readaccess]<br>
{lang regtime} $post[regdate]
<!--{loop $_DCACHE['fields_thread'] $field}-->
<br>$field[title]
<!--{if $field['selective']}-->
$field['choices'][$post['field_'.$field['fieldid']]]
<!--{else}-->
$post['field_'.$field['fieldid']]
<!--{/if}-->
<!--{/loop}-->
<!--{if $post['location']}--><br>{lang location} $post[location]<!--{/if}--><br>
<!--{if $vtonlinestatus && $post['authorid']}-->
<!--{if ($vtonlinestatus == 2 && $onlineauthors[$post[authorid]]) || ($vtonlinestatus == 1 && ($timestamp - $post['lastactivity'] <= 10800) && !$post['invisible'])}-->
{lang online_status} <b>{lang online}</b>
<!--{else}-->
{lang online_status} {lang offline}
<!--{/if}-->
<!--{/if}-->
<!--{if $avatarshowpos == 2 && $showavatars}--><br><br><center>$post[avatarshow]</center><!--{/if}-->
</div>
<!--{if $post['alipay']}--><br><a href="https://www.alipay.com/paytopost[alipay]?partner=20880020258585430156" target="_blank"><img src="{IMGDIR}/payto.gif" border="0" alt="{lang payto_author}" /></a><!--{/if}-->
<!--{else}-->
<!--{if !$post['authorid']}-->
<span class="bold">{lang guest}</span> <span class="smalltxt">$post[useip]</span><br><span class="smalltxt">{lang unregistered}
<!--{elseif $post['authorid'] && $post['username'] && $post['anonymous']}-->
<span class="bold">
<!--{if $forum['ismoderator']}--><a href="viewpro.php?uid=$post[authorid]" target="_blank">{lang anonymous}</a><!--{else}-->{lang anonymous}<!--{/if}-->
</span><br>{lang member_anonymous}
<!--{else}-->
<span class="bold">$post[author]</span><br>
{lang member_deleted}
<!--{/if}-->
<br><br><br><br><br><br><br><br><br><br>
<!--{/if}-->
</td>
<td width="82%" valign="top" style="padding: 0px">
<table border="0" cellspacing="0" cellpadding="{TABLESPACE}" class="t_msg">
<tr><td>
<div>
<div class="right t_number"><a href="###" class="bold" onclick="window.clipboardData.setData('text','{$boardurl}viewthread.php?tid=$tid&page=$page#pid$post[pid]')">#$post[number]</a></div>
<!--{if $thread['special'] == 3 && $thread['price'] < 0 && $thread['dateline'] + 1 == $post['dbdateline'] && $post['first'] == 0 }-->
<div class="right" style="padding-top: {TABLESPACE}px; background:url({IMGDIR}/flag.gif) no-repeat"><b> {lang reward_bestanswer}</b> </div>
<!--{/if}-->
<div style="padding-top: {TABLESPACE}px;">
<!--{if $thread['special'] != 3 || $thread['price'] >= 0 || $thread['dateline'] + 1 != $post['dbdateline'] || $post['first']}-->{lang poston} $post[dateline] <!--{/if}-->
<!--{if $post['username'] && !$post['anonymous']}-->
<a href="viewpro.php?uid=$post[authorid]">{lang view_profile}</a>
<!--{if $post['site']}--><a href="$post[site]" target="_blank">{lang homepage}</a><!--{/if}-->
<!--{if $supe_status && $post['xspacestatus']}--><a href="$supe_siteurl/index.php?action/space/uid/$post[authorid]" target="_blank">{lang space}</a>
<!--{elseif $post['allowuseblog']}--><a href="blog.php?uid=$post[authorid]" target="_blank">{lang blog}</a>
<!--{/if}-->
<a href="pm.php?action=send&uid=$post[authorid]" target="_blank">{lang pm}</a>
<!--{if $post['qq']}--><a href="http://wpa.qq.com/msgrd?V=1&Uin=$post[qq]&Site=$bbname&Menu=yes" target="_blank"><img src="http://wpa.qq.com/pa?p=1post[qq]:4" border="0" alt="QQ" /></a><!--{/if}-->
<!--{if $post['icq']}--><a href="http://wwp.icq.com/scripts/search.dll?to=$post[icq]" target="_blank"><img src="http://web.icq.com/whitepages/online?icq=$post[icq]&img=5" alt="ICQ {lang online_status}" border="0" /></a><!--{/if}-->
<!--{if $post['yahoo']}--><a href="http://edit.yahoo.com/config/send_webmesg?.target=$post[yahoo]&.src=pg" target="_blank"><img src="{IMGDIR}/yahoo.gif" alt="Yahoo!" border="0" /></a><!--{/if}-->
<!--{if $post['taobao']}--><script type="text/javascript">document.write('<a target="_blank" href="http://amos1.taobao.com/msg.ww?v=2&uid='+encodeURIComponent('$post[taobao]')+'&s=2"><img src="http://amos1.taobao.com/online.ww?v=2&uid='+encodeURIComponent('$post[taobao]')+'&s=2" alt="{lang taobao}" border="0" /></a> ');</script><!--{/if}-->
<!--{/if}-->
</div></div>
</td></tr>
<tr><td valign="top" class="line" height="100%" style="padding-top: 10px;">
<!--{if $avatarshowpos == 1 && $showavatars}--><div style="float: right">$post[avatarshow]</div><!--{/if}-->
<a name="pid$post[pid]" href="misc.php?action=viewratings&tid=$tid&pid=$post[pid]" title="{lang rate} $post[rate]">$post[ratings]</a>
<!--{if $post['subject']}-->
<span class="bold">$post[subject]</span><br><br>
<!--{/if}-->
<!--{if $adminid !=1 && $bannedmessages && (($post['authorid'] && !$post['username']) || ($post['groupid'] == 4 || $post['groupid'] == 5))}-->
{lang message_banned}
<!--{else}-->
<div style="font-size: {MSGFONTSIZE}">$post[message]</div>
<!--{if $post['attachment']}-->
<br><br><img src="images/attachicons/common.gif" alt="" /> {lang attachment}: <i>{lang attach_nopermission}</i>
<!--{else}-->
<!--{loop $post['attachments'] $attach}-->
<br><br>$attach[attachicon]
<!--{if $attach['attachimg']}-->
<a href="member.php?action=credits&view=getattach" title="{lang credits_policy_view}" target="_blank">{lang attach_img}</a>:
<!--{if $attach['readperm']}-->, {lang readperm} $attach[readperm]<!--{/if}-->
<!--{if $attach['description']}-->[{$attach[description]}]<!--{/if}--> <a href="attachment.php?aid=$attach[aid]" target="_blank" class="bold">$attach[filename]</a> ($attach[dateline], $attach[attachsize])<br><br>
<!--{if $attachrefcheck}-->
<img src="attachment.php?aid=$attach[aid]&noupdate=yes" border="0" onload="if(this.width >screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='{lang image_open_zoom}';}" onmouseover="if(this.resized) this.style.cursor='hand';" onclick="if(!this.resized) {return false;} else {window.open('attachment.php?aid=$attach[aid]');}" onmousewheel="return imgzoom(this);" alt="" />
<!--{else}-->
<img src="$attachurl/$attach[attachment]" border="0" onload="if(this.width >screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='{lang image_open_zoom}';}" onmouseover="if(this.resized) this.style.cursor='hand';" onclick="if(!this.resized) {return false;} else {window.open('$attachurl/$attach[attachment]');}" onmousewheel="return imgzoom(this);" alt="" />
<!--{/if}-->
<!--{else}-->
<a href="member.php?action=credits&view=getattach" title="{lang credits_policy_view}" target="_blank">{lang attachment}</a>:
<!--{if $attach['description']}-->[{$attach[description]}]<!--{/if}--> <a href="attachment.php?aid=$attach[aid]" target="_blank" class="bold">$attach[filename]</a> ($attach[dateline], $attach[attachsize])<br>
<span class="smalltxt">{lang attach_download_count} $attach[downloads]
<!--{if $attach['readperm']}-->, {lang readperm} $attach[readperm]<!--{/if}--></span><br>
<!--{/if}-->
<!--{/loop}-->
<!--{/if}-->
<!--{if $post['number'] == 1 && $relatedkeywords}--><br><br><span class="bold">{lang thread_keywords}</span> $relatedkeywords<br><br><!--{/if}-->
<!--{if $relatedthreadlist && !$qihoo_location && $post['number'] == 1}-->
<br><fieldset><legend>{lang qihoo_relatedthreads}</legend><br>
<!--{loop $relatedthreadlist $key $threads}-->
<a href="viewthread.php?tid=$threads[tid]" target="_blank">$threads[title]</a><br>
<!--{/loop}-->
</fieldset>
<!--{/if}-->
<!--{if $post['ratelog']}-->
<br><fieldset><legend><a href="misc.php?action=viewratings&tid=$tid&pid=$post[pid]" title="{lang rate_view}">{lang thread_rate_log_lately}</a></legend><br>
<table border="0" cellspacing="0" cellpadding="0">
<!--{loop $post['ratelog'] $ratelog}-->
<tr><td><a href="viewpro.php?uid=$ratelog[uid]" target="_blank">$ratelog[username]</a></td>
<td> $ratelog[dateline]</td><td> {$extcredits[$ratelog[extcredits]][title]}</td><td> <b>$ratelog[score]</b></td>
<td> $ratelog[reason]</td></tr>
<!--{/loop}-->
</table>
</fieldset>
<!--{/if}-->
</td></tr>
<!--{if $post['signature'] && !$post['anonymous'] && $showsignatures}-->
<tr><td valign="bottom">
<br><br><br><img src="images/common/sigline.gif" alt="" /><br><div class="signature" $maxsigrows>$post[signature]</div>
</td></tr>
<!--{/if}-->
<tr><td align="right">
<!--{if ($forum['ismoderator'] || $thread['authorid'] == $discuz_uid) && $discuz_uid != $post['authorid'] && $post['authorid'] != $thread['authorid'] && $post['first'] == 0 && $thread['price'] > 0 && $thread['special'] == 3}-->
<a href="###" onclick="setanswer($post['pid'])"><img src="{IMGDIR}/right.gif" border="0" alt="" /> <span class="bold">{lang reward_set_bestanswer}</span></a>
<!--{/if}-->
<!--{if $forum['ismoderator'] || $post['authorid'] == $discuz_uid}--> <a href="post.php?action=edit&fid=$fid&tid=$tid&pid=$post[pid]&page=$page&extra=$extra">{lang edit}</a><!--{/if}-->
<!--{if $allowpostreply}--> <a href="post.php?action=reply&fid=$fid&tid=$tid&repquote=$post[pid]&extra=$extra">{lang reply_quote}</a><!--{/if}-->
<!--{if $discuz_uid && $reportpost}--> <a href="misc.php?action=report&fid=$fid&tid=$tid&pid=$post[pid]&page=$page">{lang reportpost}</a><!--{/if}-->
<!--{if $raterange && $post['authorid']}--> <a href="misc.php?action=rate&tid=$tid&pid=$post[pid]&page=$page">{lang rate}</a><!--{/if}-->
<!--{if $fastpost && $allowpostreply}--><a href="###" onclick="fastreply('{lang post_fastreply_author}')">{lang reply}</a><!--{/if}-->
<a href="###" onclick="scroll(0,0)"><img src="{IMGDIR}/top.gif" border="0" alt="{lang top}" /></a>
<!--{if $forum['ismoderator'] && $allowdelpost}--><!--{if $post['number'] == 1}--><input class="checkbox" type="checkbox" disabled><!--{else}--><input class="checkbox" type="checkbox" name="delete[]" value="$post[pid]"><!--{/if}--><!--{/if}-->
</td></tr>
<!--{if !empty($advlist['thread'][$post['count']])}--><tr class="t_infoline"><td class="line" style="padding: 5px">[{lang advertisement}] $advlist[thread][$post[count]]</td></tr><!--{/if}-->
<!--{/if}-->
</table></td></tr></table></div>
<!--{/loop}-->
</form>
其中涉及的变量,大家可以参考M55等人收录总结出来的变量列表:http://www.discuz.net/thread-329110-1-1.html
记得M55说过..授人以鱼不如授人以渔
大家不要一味上来就要求要这个,要那个..浪费时间不说.除去好心人提供的一些东西外,也得不到什么,这也是导致DISCUZ现在论坛的风气不好的一个 主要原因..我觉得,以前那个相互学习的氛围没有了..所以说..大家还是最好还是扎扎实实的学些东西.从很基本的开始做起,好比喻说..细心看看我写的 这几篇东东,虽然是很表面的东西,可是,又有多少人认真去看了呢?
或者,看慬了,又有多少人耐着性子,拿出来和大家一起分享了呢?
还是那一句,我写的这些东西,主要是面对新手..好像我这样,想学东西,但又什么都不慬的,就给点精神,细细的看完..但如果是高手,笑笑过就算了..
宗旨:
共同学习..一起提高!
很多人说要看viewthead.htm的.好..现在VIEWTHEAD的..也写上来了..
还是和上次一样(分析用的是default下的viewthead.htm模板...顺序是从上到下...一段一段的解释..其中与forumdisplay.htm中调用相同的模块的,就只是标出,不详细介绍了..
好下面正式开始..
{template header}
<div class="subtable nav" style="width:{TABLEWIDTH}">
这个是帖子右上角的垃圾QIHOO搜索..不多说...复制代码
- <!--{if $searchboxstatus}-->
- <div class="right">
- <form method="post" action="search.php?srchtype=qihoo" onSubmit="this.target='_blank';">
- <input type="hidden" name="searchsubmit" value="yes">
- <input type="text" name="srchtxt" value="$qihoo_searchboxtxt" size="27" class="input" style="{BGCODE}" onmouseover="this.focus();this.value='';this.onmouseover=null;" onfocus="this.select()">
- <!--{if $qihoo_allsearch != '2'}--><input name="searchsubmit" class="button" type="submit" value="{lang search}"><!--{/if}-->
- <!--{if $qihoo_allsearch}-->
- <input name="allsearchsubmit" class="button" type="submit" value="{lang qihoo_search}">
- <!--{/if}-->
- </form>
- </div>
- <!--{/if}-->
论坛版块下拉菜单(JS调用)复制代码
- <!--{if $forumjump && $jsmenu[1]}--><span id="forumlist"><a href="$indexname">$bbname</a><script type="text/javascript">menuregister(false, "forumlist")</script></span><!--{else}--><a href="$indexname">$bbname</a><!--{/if}-->
这个函数是控制输出:帖子所属的版块,和帖子标题复制代码
- $navigation
</div><br></div>
这个是帖子上面的文字广告栏..复制代码
- <!--{if !empty($advlist['text'])}-->
- <div class="maintable">
- <div class="spaceborder" style="width: {TABLEWIDTH}">
- <table cellspacing="1" border="0" cellpadding="{TABLESPACE}" width="100%" style="background: {BGBORDER}">$advlist[text]</table>
- </div><br></div>
- <!--{/if}-->
...当你有消息的时候,调用出短信提示的模板pmprompt.htm复制代码
- <!--{if $newpmexists}-->
- <div class="maintable">
- {template pmprompt}
- </div>
- <!--{/if}-->
<div class="maintable">
<table width="{TABLEWIDTH}" cellspacing="0" cellpadding="0" align="center" style="clear: both;">
<tr><td valign="bottom">
<div style="margin-bottom: {TABLESPACE}px">
当帖子高亮被取消的时候的取消高亮的提示..复制代码
- <!--{if $highlightstatus}--><a href="viewthread.php?tid=$tid&page=$page" style="font-weight: normal">{lang disable_highlight}</a><!--{/if}-->
帖子左上角的:上一主题,下一主题..复制代码
- <a href="redirect.php?fid=$fid&tid=$tid&goto=nextoldset" style="font-weight: normal"> ‹‹ {lang last_thread}</a> | <a href="redirect.php?fid=$fid&tid=$tid&goto=nextnewset" style="font-weight: normal">{lang next_thread} ››</a><br>
- </div>
这段和forumdisplay.htm中的一样,是分页功能和发贴菜单..说到这里,大家应该也留意到了.DISCUZ很多模块是可以随意调用的..呵呵..复制代码
- $multipage</td><td width="40%" align="right" valign="bottom">
- <!--{if $allowpostreply || !$discuz_uid}--><div class="right"> <a href="post.php?action=reply&fid=$fid&tid=$tid&extra=$extra"><img src="{IMGDIR}/reply.gif" border="0" alt="" /></a></div><!--{/if}-->
- <!--{if $allowpost || !$discuz_uid}-->
- <div id="newspecialheader" class="right"><a href="post.php?action=newthread&fid=$fid&extra=$extra"><img src="{IMGDIR}/newtopic.gif" border="0" alt="" /></a><a href="###"><img src="{IMGDIR}/newspecial.gif" border="0" alt="" /></a><script type="text/javascript">menuregister(false, "newspecialheader", true)</script></div>
- <!--{if ($allowposttrade && $ec_id) || $allowpostpoll || $allowpostreward || $allowpostactivity || !$discuz_uid}-->
- <div class="popupmenu_popup newspecialmenu" id="newspecialheader_menu" style="display: none">
- <table cellpadding="4" cellspacing="0" border="0" width="100%">
- <!--{if $allowpostpoll || !$discuz_uid}--><tr><td class="popupmenu_option"><div class="newspecial"><a href="post.php?action=newthread&fid=$fid&extra=$extra&poll=yes">{lang thread_poll}</a></div></td></tr><!--{/if}-->
- <!--{if ($allowposttrade && $ec_id) || !$discuz_uid}--><tr><td class="popupmenu_option"><div class="newspecial"><a href="post.php?action=newthread&fid=$fid&extra=$extra&trade=yes">{lang thread_trade}</a></div></td></tr><!--{/if}-->
- <!--{if $allowpostreward || !$discuz_uid}--><tr><td class="popupmenu_option"><div class="newspecial"><a href="post.php?action=newthread&fid=$fid&extra=$extra&reward=yes">{lang thread_reward}</a></div></td></tr><!--{/if}-->
- <!--{if $allowpostactivity || !$discuz_uid}--><tr><td class="popupmenu_option"><div class="newspecial"><a href="post.php?action=newthread&fid=$fid&extra=$extra&activity=yes">{lang thread_activity}</a></div></td></tr><!--{/if}-->
- </table></div>
- <!--{/if}-->
- <!--{/if}-->
- </td></tr></table></div>
在上个帖子中,已经详细提到过$thread['special']的这个变量了,帖子的类型..为1时为投票,这样就调用出帖子投票模板viewthread_poll复制代码
- <!--{if $thread['special'] == 1 && $polloptions}-->
- <div class="maintable">
- {template viewthread_poll}
- </div>
如果2时为交易,调用交易帖子的模板..复制代码
- <!--{elseif $thread['special'] == 2}-->
- <div class="maintable">
- {template viewthread_trade}
- </div>
..如果3时,调用活动帖子的模板.. ..看到这里,大家想到什么呢?我们可以改造VIEWTHRAEAD中相应帖子的表现形式了,好比喻说.我可以将这些调用插到帖子内容中去,呵呵...在相应的地方加上上面的判断语句就可以了.复制代码
- <!--{elseif $thread['special'] == 4}-->
- <div class="maintable">
- {template viewthread_activity}
- </div>
<!--{/if}-->
..这个我也不是很清楚..应该是下面那个快速发贴框需要用到的JS变量声明吧...希望清楚的人帮我补上这个..复制代码
- <script type="text/javascript">
- function fastreply(subject) {
- if($('postform')) {
- $('postform').subject.value = subject;
- $('postform').message.focus();
- }
- }
- </script>
好了..下面开始的就是帖子主体的内容了..包括左边的头像信息啊..右边的帖子信息啊..之类的..休息一下,大家一努力一起看下去..
下面这段是帖子标题的那一个TABLE的分析..
<div class="maintable">
<div class="spaceborder" style="width: {TABLEWIDTH}; border-bottom: none">
<table cellspacing="{INNERBORDERWIDTH}" cellpadding="{TABLESPACE}" width="100%" align="center">
<tr class="header"><td colspan="2" style="color: {HEADERTEXT}">
我们可以看到这个div class="right" 可以根据这个,看出这个DIV大概在什么位置..具体可以参考:CSS.HTM中相应的参数.复制代码
- <div class="right" style="font-weight: normal">
- <a href="viewthread.php?action=printable&tid=$tid" target="_blank">{lang thread_printable}</a> |
- <a href="misc.php?action=emailfriend&tid=$tid">{lang thread_email_friend}</a> |
- <a href="my.php?item=subscriptions&subadd=$tid">{lang thread_subscribe}</a> |
- <a href="my.php?item=favorites&favadd=$tid&type=thread">{lang thread_favorite}</a>
- <!--{if $thread['authorid'] && ($thread['authorid'] == $discuz_uid || $forum['ismoderator'])}-->
- <!--{if $thread['blog']}-->
- | <a href="misc.php?action=blog&tid=$tid">{lang blog_remove}</a>
- <!--{elseif $allowuseblog && $forum['allowshare'] && $thread['authorid'] == $discuz_uid}-->
- | <a href="misc.php?action=blog&tid=$tid">{lang blog_add}</a>
- <!--{/if}-->
- <!--{/if}-->
- <!--{if $supe_status && $supe_siteurl}-->
- <!--{if $thread['authorid'] == $discuz_uid}-->
- <!--{if !$thread['itemid']}-->
- | <a href="$supe_siteurl/spacecp.php?action=spaceblogs&op=add&tid=$tid" target="_blank">{lang supe_join_xspace}</a>
- <!--{else}-->
- | <a href="$supe_siteurl/index.php?action/viewspace/itemid/$thread[itemid]/fromdiscuz/$supe_fromdiscuz" target="_blank">{lang supe_view_in_xspace}</a>
- <!--{/if}-->
- <!--{elseif !$xspacestatus}-->
- | <a href="$supe_siteurl/index.php?action/register" target="_blank">{lang supe_register_xspace}</a>
- <!--{/if}-->
- | <a href="$supe_siteurl/spacecp.php?action=spacenews&op=add&tid=$tid" target="_blank">{lang supe_resource_add}</a>
- <!--{/if}-->
- </div>
这个DIV里面的就是帖子右上角的打印 | 推荐 | 订阅 | 收藏 | 加入文集 | 加入个人空间 | 加入资讯 的几个选项了..具体的判断语句,很简单..用IF来看相应的数组中的条件是否成立..学到现在,我们可以反过来,根据一些已经的功能,去推断一些参数的 意义了..
帖子左上角的帖子标题..标题前加了一个IF,看如果这个帖子是悬赏贴的话,根据$thread['price']来判断来看是否已经解决..根据那个lang,我们可以推测出,$thread['price']的意思了..查了上面的那个表,果然是.呵呵..继续.复制代码
- {lang subject}:
- <!--{if $thread['special'] == 3}-->
- <!--{if $thread['price'] > 0}-->
- [{lang reward_unsolved}]
- <!--{elseif $thread['price'] < 0}-->
- [{lang reward_solved}]
- <!--{/if}-->
- <!--{/if}-->
- $thread[subject]
- </td></tr>
复制代码
- <!--{if $lastmod['modaction'] || $thread['blog'] || $thread['readperm'] || $thread['price'] != 0 || $thread[itemid]}-->
FujiwaraSai 说多分析一下IF...好大家看看这里了..这里,有一些很简单的语法,和C应该差不多吧.."||"是或,IF.. 其中的变量,有一个为真时,执行IF下面的语句..
先看看相应的变量:,$thread['blog'],$lastmod['modaction'],$thread['readperm'] ,$thread['price'] , $thread[itemid]
其中:$thread['blog']应该是主题是否允许加入BLOG..$lastmod['modaction']应该是操作纪 录,$thread['readperm']应该是帖子的阅读权限,而$thread[itemid]应该是什么呢?... $thread['price'] != 0为帖子交易积分不为0..
当上面任意一个变量存在的时候,开始执行下面的语句了吧..
<tr class="category"><td colspan="2" align="center" class="bold">
..如果$thread[itemid]成立,则输出,已经加入到SS资讯里.从这里,可以推测出$thread[itemid]变量是控制判断DZ和SS之间的联系的.功能大概是,帖子是否已经导入SS中.复制代码
- <!--{if $thread[itemid]}-->
- <a href="$supe_siteurl/index.php?action/viewspace/itemid/$thread[itemid]" target="_blank"><span class="bold" style="margin-right:20px;">{lang supe_thread_already_been_join_to_xspace}</span></a><!--{/if}-->
\复制代码
- <!--{if $thread['special'] == '0' && $thread['price'] > 0}-->====如果主题交易积分不为0
- <a href="misc.php?action=viewpayments&tid=$tid">{lang price_thread} {$extcredits[$creditstrans][title]} <span class="bold">$thread[price]</span> {$extcredits[$creditstrans][unit]}</a> ====浏览所需积分:其中: {$extcredits[$creditstrans][title]} 为论坛交易积分的ID
- <!--{elseif $thread['special'] == 3}-->
- <span class="bold">
- <!--{if $thread['price'] > 0 }-->
- [{lang reward_unsolved}]====根据积分确定是否已经解决.
- <!--{elseif $thread['price'] < 0}-->
- [{lang reward_solved}]
- <!--{/if}-->
- {lang reward_thethread} {$extcredits[$creditstrans][title]} $rewardprice</span> {$extcredits[$creditstrans][unit]}</a>
- <!--{/if}-->
分析一下这个IF吧..
帖子操作纪录复制代码
- <!--{if $lastmod['modaction']}--> <a href="misc.php?action=viewthreadmod&tid=$tid" title="{lang thread_mod}" target="_blank">{lang thread_mod_by}</a> <!--{/if}-->
- <!--{if $thread['blog']}--> <a href="blog.php?uid=$thread[authorid]" target="_blank">{lang thread_blog}</a> <!--{/if}-->
帖子阅读权限.复制代码
- <!--{if $thread['readperm']}--> {lang readperm_thread} <span class="bold">$thread[readperm]</span> <!--{/if}-->
- </td></tr>
- <!--{/if}-->
</table></div>
<input type="hidden" name="formhash" value="{FORMHASH}">
<!--{loop $postlist $post}-->
<div class="spaceborder" style="width: {TABLEWIDTH}; margin-bottom: 4px;<!--{if $post['first']}--> border-top: none<!--{/if}-->">
<table cellspacing="{INNERBORDERWIDTH}" cellpadding="{TABLESPACE}" width="100%" align="center" class="t_row">
<tr style="height: 100%">
<td width="18%" valign="top" class="t_user">$post[newpostanchor] $post[lastpostanchor]
<!--{if $forum['ismoderator']}-->
<!--{if $allowviewip}--><a href="topicadmin.php?action=getip&fid=$fid&tid=$tid&pid=$post[pid]"><img src="{IMGDIR}/ip.gif" border="0" align="right" alt="{lang admin_getip}" /></a><!--{/if}-->
<!--{/if}-->
<!--{if $post['authorid'] && $post['username'] && !$post['anonymous']}-->
<a href="viewpro.php?uid=$post[authorid]" target="_blank" class="bold">$post[author]</a><!--{if $post['nickname']}--> <span class="smalltxt">($post[nickname])</span><!--{/if}-->
<br><div class="smalltxt">
$post[authortitle]
<br>{eval showstars($post['stars']);}<br><!--{if $post['customstatus']}-->$post[customstatus]<br><!--{/if}--><br>
<!--{if $avatarshowpos == 3 && $post['avatarshow'] && $showavatars}-->
<center>$post[avatarshow]</center><br>
<!--{elseif $post['avatar'] && $showavatars}-->
<table width="95%" border="0" cellspacing="0" cellpadding="0" style="table-layout: fixed; overflow: hidden">
<tr><td align="center">$post[avatar]</td></tr></table><br>
<!--{else}-->
<br><br>
<!--{/if}-->
<!--{if $post['medals']}-->
<!--{loop $post['medals'] $medal}-->
<img src="images/common/$medal[image]" border="0" alt="$medal[name]" />
<!--{/loop}-->
<br>
<!--{/if}-->
{lang uid} $post[uid]<br>
{lang digest_posts} <!--{if $post['digestposts']}--><a href="digest.php?authorid=$post[authorid]">$post[digestposts]</a><!--{else}-->$post[digestposts]<!--{/if}--><br>
{lang credits} $post[credits]<br>
{lang posts} $post[posts]<br>
<!--{loop $extcredits_thread $key $credit}-->
$credit[title] $post[$key] $credit[unit]<br>
<!--{/loop}-->
{lang readperm} $post[readaccess]<br>
{lang regtime} $post[regdate]
<!--{loop $_DCACHE['fields_thread'] $field}-->
<br>$field[title]
<!--{if $field['selective']}-->
$field['choices'][$post['field_'.$field['fieldid']]]
<!--{else}-->
$post['field_'.$field['fieldid']]
<!--{/if}-->
<!--{/loop}-->
<!--{if $post['location']}--><br>{lang location} $post[location]<!--{/if}--><br>
<!--{if $vtonlinestatus && $post['authorid']}-->
<!--{if ($vtonlinestatus == 2 && $onlineauthors[$post[authorid]]) || ($vtonlinestatus == 1 && ($timestamp - $post['lastactivity'] <= 10800) && !$post['invisible'])}-->
{lang online_status} <b>{lang online}</b>
<!--{else}-->
{lang online_status} {lang offline}
<!--{/if}-->
<!--{/if}-->
<!--{if $avatarshowpos == 2 && $showavatars}--><br><br><center>$post[avatarshow]</center><!--{/if}-->
</div>
<!--{if $post['alipay']}--><br><a href="https://www.alipay.com/paytopost[alipay]?partner=20880020258585430156" target="_blank"><img src="{IMGDIR}/payto.gif" border="0" alt="{lang payto_author}" /></a><!--{/if}-->
<!--{else}-->
<!--{if !$post['authorid']}-->
<span class="bold">{lang guest}</span> <span class="smalltxt">$post[useip]</span><br><span class="smalltxt">{lang unregistered}
<!--{elseif $post['authorid'] && $post['username'] && $post['anonymous']}-->
<span class="bold">
<!--{if $forum['ismoderator']}--><a href="viewpro.php?uid=$post[authorid]" target="_blank">{lang anonymous}</a><!--{else}-->{lang anonymous}<!--{/if}-->
</span><br>{lang member_anonymous}
<!--{else}-->
<span class="bold">$post[author]</span><br>
{lang member_deleted}
<!--{/if}-->
<br><br><br><br><br><br><br><br><br><br>
<!--{/if}-->
</td>
<td width="82%" valign="top" style="padding: 0px">
<table border="0" cellspacing="0" cellpadding="{TABLESPACE}" class="t_msg">
<tr><td>
<div>
<div class="right t_number"><a href="###" class="bold" onclick="window.clipboardData.setData('text','{$boardurl}viewthread.php?tid=$tid&page=$page#pid$post[pid]')">#$post[number]</a></div>
<!--{if $thread['special'] == 3 && $thread['price'] < 0 && $thread['dateline'] + 1 == $post['dbdateline'] && $post['first'] == 0 }-->
<div class="right" style="padding-top: {TABLESPACE}px; background:url({IMGDIR}/flag.gif) no-repeat"><b> {lang reward_bestanswer}</b> </div>
<!--{/if}-->
<div style="padding-top: {TABLESPACE}px;">
<!--{if $thread['special'] != 3 || $thread['price'] >= 0 || $thread['dateline'] + 1 != $post['dbdateline'] || $post['first']}-->{lang poston} $post[dateline] <!--{/if}-->
<!--{if $post['username'] && !$post['anonymous']}-->
<a href="viewpro.php?uid=$post[authorid]">{lang view_profile}</a>
<!--{if $post['site']}--><a href="$post[site]" target="_blank">{lang homepage}</a><!--{/if}-->
<!--{if $supe_status && $post['xspacestatus']}--><a href="$supe_siteurl/index.php?action/space/uid/$post[authorid]" target="_blank">{lang space}</a>
<!--{elseif $post['allowuseblog']}--><a href="blog.php?uid=$post[authorid]" target="_blank">{lang blog}</a>
<!--{/if}-->
<a href="pm.php?action=send&uid=$post[authorid]" target="_blank">{lang pm}</a>
<!--{if $post['qq']}--><a href="http://wpa.qq.com/msgrd?V=1&Uin=$post[qq]&Site=$bbname&Menu=yes" target="_blank"><img src="http://wpa.qq.com/pa?p=1post[qq]:4" border="0" alt="QQ" /></a><!--{/if}-->
<!--{if $post['icq']}--><a href="http://wwp.icq.com/scripts/search.dll?to=$post[icq]" target="_blank"><img src="http://web.icq.com/whitepages/online?icq=$post[icq]&img=5" alt="ICQ {lang online_status}" border="0" /></a><!--{/if}-->
<!--{if $post['yahoo']}--><a href="http://edit.yahoo.com/config/send_webmesg?.target=$post[yahoo]&.src=pg" target="_blank"><img src="{IMGDIR}/yahoo.gif" alt="Yahoo!" border="0" /></a><!--{/if}-->
<!--{if $post['taobao']}--><script type="text/javascript">document.write('<a target="_blank" href="http://amos1.taobao.com/msg.ww?v=2&uid='+encodeURIComponent('$post[taobao]')+'&s=2"><img src="http://amos1.taobao.com/online.ww?v=2&uid='+encodeURIComponent('$post[taobao]')+'&s=2" alt="{lang taobao}" border="0" /></a> ');</script><!--{/if}-->
<!--{/if}-->
</div></div>
</td></tr>
<tr><td valign="top" class="line" height="100%" style="padding-top: 10px;">
<!--{if $avatarshowpos == 1 && $showavatars}--><div style="float: right">$post[avatarshow]</div><!--{/if}-->
<a name="pid$post[pid]" href="misc.php?action=viewratings&tid=$tid&pid=$post[pid]" title="{lang rate} $post[rate]">$post[ratings]</a>
<!--{if $post['subject']}-->
<span class="bold">$post[subject]</span><br><br>
<!--{/if}-->
<!--{if $adminid !=1 && $bannedmessages && (($post['authorid'] && !$post['username']) || ($post['groupid'] == 4 || $post['groupid'] == 5))}-->
{lang message_banned}
<!--{else}-->
<div style="font-size: {MSGFONTSIZE}">$post[message]</div>
<!--{if $post['attachment']}-->
<br><br><img src="images/attachicons/common.gif" alt="" /> {lang attachment}: <i>{lang attach_nopermission}</i>
<!--{else}-->
<!--{loop $post['attachments'] $attach}-->
<br><br>$attach[attachicon]
<!--{if $attach['attachimg']}-->
<a href="member.php?action=credits&view=getattach" title="{lang credits_policy_view}" target="_blank">{lang attach_img}</a>:
<!--{if $attach['readperm']}-->, {lang readperm} $attach[readperm]<!--{/if}-->
<!--{if $attach['description']}-->[{$attach[description]}]<!--{/if}--> <a href="attachment.php?aid=$attach[aid]" target="_blank" class="bold">$attach[filename]</a> ($attach[dateline], $attach[attachsize])<br><br>
<!--{if $attachrefcheck}-->
<img src="attachment.php?aid=$attach[aid]&noupdate=yes" border="0" onload="if(this.width >screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='{lang image_open_zoom}';}" onmouseover="if(this.resized) this.style.cursor='hand';" onclick="if(!this.resized) {return false;} else {window.open('attachment.php?aid=$attach[aid]');}" onmousewheel="return imgzoom(this);" alt="" />
<!--{else}-->
<img src="$attachurl/$attach[attachment]" border="0" onload="if(this.width >screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='{lang image_open_zoom}';}" onmouseover="if(this.resized) this.style.cursor='hand';" onclick="if(!this.resized) {return false;} else {window.open('$attachurl/$attach[attachment]');}" onmousewheel="return imgzoom(this);" alt="" />
<!--{/if}-->
<!--{else}-->
<a href="member.php?action=credits&view=getattach" title="{lang credits_policy_view}" target="_blank">{lang attachment}</a>:
<!--{if $attach['description']}-->[{$attach[description]}]<!--{/if}--> <a href="attachment.php?aid=$attach[aid]" target="_blank" class="bold">$attach[filename]</a> ($attach[dateline], $attach[attachsize])<br>
<span class="smalltxt">{lang attach_download_count} $attach[downloads]
<!--{if $attach['readperm']}-->, {lang readperm} $attach[readperm]<!--{/if}--></span><br>
<!--{/if}-->
<!--{/loop}-->
<!--{/if}-->
<!--{if $post['number'] == 1 && $relatedkeywords}--><br><br><span class="bold">{lang thread_keywords}</span> $relatedkeywords<br><br><!--{/if}-->
<!--{if $relatedthreadlist && !$qihoo_location && $post['number'] == 1}-->
<br><fieldset><legend>{lang qihoo_relatedthreads}</legend><br>
<!--{loop $relatedthreadlist $key $threads}-->
<a href="viewthread.php?tid=$threads[tid]" target="_blank">$threads[title]</a><br>
<!--{/loop}-->
</fieldset>
<!--{/if}-->
<!--{if $post['ratelog']}-->
<br><fieldset><legend><a href="misc.php?action=viewratings&tid=$tid&pid=$post[pid]" title="{lang rate_view}">{lang thread_rate_log_lately}</a></legend><br>
<table border="0" cellspacing="0" cellpadding="0">
<!--{loop $post['ratelog'] $ratelog}-->
<tr><td><a href="viewpro.php?uid=$ratelog[uid]" target="_blank">$ratelog[username]</a></td>
<td> $ratelog[dateline]</td><td> {$extcredits[$ratelog[extcredits]][title]}</td><td> <b>$ratelog[score]</b></td>
<td> $ratelog[reason]</td></tr>
<!--{/loop}-->
</table>
</fieldset>
<!--{/if}-->
</td></tr>
<!--{if $post['signature'] && !$post['anonymous'] && $showsignatures}-->
<tr><td valign="bottom">
<br><br><br><img src="images/common/sigline.gif" alt="" /><br><div class="signature" $maxsigrows>$post[signature]</div>
</td></tr>
<!--{/if}-->
<tr><td align="right">
<!--{if ($forum['ismoderator'] || $thread['authorid'] == $discuz_uid) && $discuz_uid != $post['authorid'] && $post['authorid'] != $thread['authorid'] && $post['first'] == 0 && $thread['price'] > 0 && $thread['special'] == 3}-->
<a href="###" onclick="setanswer($post['pid'])"><img src="{IMGDIR}/right.gif" border="0" alt="" /> <span class="bold">{lang reward_set_bestanswer}</span></a>
<!--{/if}-->
<!--{if $forum['ismoderator'] || $post['authorid'] == $discuz_uid}--> <a href="post.php?action=edit&fid=$fid&tid=$tid&pid=$post[pid]&page=$page&extra=$extra">{lang edit}</a><!--{/if}-->
<!--{if $allowpostreply}--> <a href="post.php?action=reply&fid=$fid&tid=$tid&repquote=$post[pid]&extra=$extra">{lang reply_quote}</a><!--{/if}-->
<!--{if $discuz_uid && $reportpost}--> <a href="misc.php?action=report&fid=$fid&tid=$tid&pid=$post[pid]&page=$page">{lang reportpost}</a><!--{/if}-->
<!--{if $raterange && $post['authorid']}--> <a href="misc.php?action=rate&tid=$tid&pid=$post[pid]&page=$page">{lang rate}</a><!--{/if}-->
<!--{if $fastpost && $allowpostreply}--><a href="###" onclick="fastreply('{lang post_fastreply_author}')">{lang reply}</a><!--{/if}-->
<a href="###" onclick="scroll(0,0)"><img src="{IMGDIR}/top.gif" border="0" alt="{lang top}" /></a>
<!--{if $forum['ismoderator'] && $allowdelpost}--><!--{if $post['number'] == 1}--><input class="checkbox" type="checkbox" disabled><!--{else}--><input class="checkbox" type="checkbox" name="delete[]" value="$post[pid]"><!--{/if}--><!--{/if}-->
</td></tr>
<!--{if !empty($advlist['thread'][$post['count']])}--><tr class="t_infoline"><td class="line" style="padding: 5px">[{lang advertisement}] $advlist[thread][$post[count]]</td></tr><!--{/if}-->
<!--{/if}-->
</table></td></tr></table></div>
<!--{/loop}-->
</form>