演示
效果 :
具体可见
分享网相应的帖子内容.
功能:
主题TAG相应
主题列表.
无TAG时,将主题发表作者相应主题列表.
无限乱数,将不会有重复主题出现.
有效地
解决吸引游客等问题.
找到viewthread.
php.
查找:
Copy
语言代码:
$thread['tags'] .= '<a href="tag.php?name='.rawurlencode($tags['tagname']).'" target="_blank">'.$tags['tagname'].'</a> ';
修改为:(此处修改修正TAG显示样式为红色)
Copy
语言代码:
$thread['tags'] .= '<a href="tag.php?name='.rawurlencode($tags['tagname']).'" target="_blank"><font color=red>'.$tags['tagname'].'</font></a> ';
查找:
Copy
语言代码:
viewthread_updateviews();
@extract($_DCACHE['custominfo']);
在它们的上面添加:
Copy
语言代码:
$tagon=1; //此功能开关,0为关,1为开;
$sqlsum=5; //主题显示条数,TAG下实际情况,用户主题准确
$tagsa = explode(',',$metakeywords);
$count=count($tagsa)-2;
$sunm=rand(0,$count);
if($tagon!=0){
if(empty($metakeywords)){
$query = $db->query("SELECT `tid`,`author` FROM `{$tablepre}posts` WHERE `tid` =$tid AND `first`>0 LIMIT 0,1");
while ($authora=$db->fetch_array($query)){
$author['author']=$authora['author'];
}
unset($query);
}
!empty($metakeywords)?$sql="SELECT `tid`,`subject`,`author`,`dateline` FROM `{$tablepre}posts` WHERE `first`>0 AND `subject` LIKE '%$tagsa[$sunm]%' LIMIT 0,$sqlsum":$sql="SELECT *
FROM `{$tablepre}posts` WHERE `author`='{$author['author']}' AND `tid`!=$tid AND `first`>0 ORDER BY `pid` DESC LIMIT 0 , $sqlsum";
$tagarray=array();
$tagsell = array();
$query = $db->query("$sql");
while ($tagsell=$db->fetch_array($query)) {
$tagsell['tid'] = $tagsell['tid'];
$tagsell['subject'] = cutstr($tagsell['subject'],45);
$tagsell['author'] = cutstr($tagsell['author'],9);
$tagsell['dateline']= gmdate("$dateformat $timeformat", $tagsell['dateline'] + $timeoffset * 3600);
$tagarray[] = $tagsell;
}}
注意:配置
文件可自行设置一下,建议为了站点
规则,显示条数为10条之下!!
打开viewthread.htm文件,
先
删除掉如下代码, 请用查找功能:
Copy
语言代码:
<p class="posttags">{lang thread_keywords}
<!--{if $thread['tags']}-->$thread[tags]<!--{/if}-->
再查找:
Copy
语言代码:
<!--{if $post['signature'] && !$post['anonymous'] && $showsignatures}-->
<div class="signatures" style="maxHeightIE: {MAXSIGROWS}px;">
$post[signature]
</div>
<!--{/if}-->
在它的上面添加:(A3)
Copy
语言代码:
<!--{if !empty($tagarray)&&$post['number']==1}-->
<h3 style="background:none; border:1px solid #99CC33; color:#333333"><span><!--{if empty($metakeywords)}-->该用户相关主题列表<!--{else}-->{lang thread_keywords}<!--{/if}-->
<!--{if $thread['tags']}-->$thread[tags]<!--{/if}--></span></h3>
<!--{loop $tagarray $tagsell}-->
<div style="border:1px solid #99CC33;margin-top:2px; line-height:25px; width:100%;"><span style="float:left; line-height:25px; width:150px; text-align:left; border-right:1px solid #99CC33; margin-left:5px;"> <font color="#666666">作者</font>: <a href="space.php?username=$tagsell[author]" target="_blank">$tagsell[author]</a></span><span style="float:left; line-height:25px; width:400px; text-align:left; border-right:1px solid #99CC33; margin-left:5px;"> <font color="#666666">主题</font>: <a href="thread-$tagsell[tid]-1-1.html" target="_blank">$tagsell[subject]</a></span><span style="float:left; line-height:25px; width:150px; text-align:left; margin-right:1px solid #99CC33; margin-left:5px;"> <font color="#666666">时间</font>: $tagsell[dateline]</span></div>
<!--{/loop}-->
<!--{/if}-->
完美兼容FF就用以下代码:(A3)
Copy
语言代码:
<!--{if !empty($tagarray)&&$post['number']==1}-->
<h3 style="background:none; color:#333333"><span><!--{if empty($metakeywords)}-->该用户相关主题列表<!--{else}-->{lang thread_keywords}<!--{/if}-->
<!--{if $thread['tags']}-->$thread[tags]<!--{/if}--></span></h3>
<table width="100%" border="0">
<!--{loop $tagarray $tagsell}-->
<tr>
<td width="20%" style="border-bottom:1px solid #ECF4FB"> <font color="#666666">作者</font>: <a href="space.php?username=$tagsell[author]" target="_blank">$tagsell[author]</a></td>
<td width="60%" style="border-bottom:1px solid #ECF4FB"><font color="#666666">主题</font>: <a href="thread-$tagsell[tid]-1-1.html" target="_blank">$tagsell[subject]</a></td>
<td width="20%" style="border-bottom:1px solid #ECF4FB"><font color="#666666">时间</font>: $tagsell[dateline]</td>
</tr>
<!--{/loop}-->
</table>
<!--{/if}-->
边线颜色为:#99CC33.用户可试着将代码:background:none;删除掉, 看看效果,呵呵.
已经修正部分链接,
解决TAG显示两处的问题.