本帖最后由 晏鼹鼠 于 2009-6-11 19:53 编辑
//记录的PHP调用代码,调用6条
$doinglist = array();
if(ckprivacy('doing')) {
$query = $_SGLOBAL['db']->query("SELECT * FROM ".tname('doing')." WHERE uid='$space[uid]' ORDER BY dateline DESC LIMIT 0,6");
while ($value = $_SGLOBAL['db']->fetch_array($query)) {
$doinglist[] = $value;
}
}
//日志的PHP调用代码,调用6条
$bloglist = array();
if(ckprivacy('blog')) {
$query = $_SGLOBAL['db']->query("SELECT b.uid, b.blogid, b.subject, b.dateline, b.pic, b.picflag, b.viewnum, b.replynum, b.friend, b.password, bf.message, bf.target_ids
FROM ".tname('blog')." b
LEFT JOIN ".tname('blogfield')." bf ON bf.blogid=b.blogid
WHERE b.uid='$space[uid]'
ORDER BY b.dateline DESC LIMIT 0,6");
while ($value = $_SGLOBAL['db']->fetch_array($query)) {
if(ckfriend($value)) {
$value['pic'] = mkpicurl($value);
$value['message'] = $value['friend']==4?'':getstr($value['message'], 150, 0, 0, 0, 0, -1);
$bloglist[] = $value;
}
}
$blognum = count($bloglist);
}
记录的HTML增加了有无判断,没有不显示。
<!--{if $doinglist}-->
<h2>
<a href="space.php?uid=$space[uid]&do=doing&view=me" class="r_option">全部</a>
记录
</h2>
<div id="space_doing" class="box">
<ul class="post_list line_list" id="doing_ul">
<!--{loop $doinglist $value}-->
<li>$value[message] (<a href="space.php?uid=$value[uid]&do=doing&doid=$value[doid]&goto=yes"><!--{if $value[replynum]}-->$value[replynum]个<!--{/if}-->回复</a>)</li>
<!--{/loop}-->
</ul>
</div>
<!--{elseif $space[self]}-->
<h2>记录</h2>
<div class="box">
<a href="space.php?do=doing&view=me"><img src="image/intro_doing.gif" class="noimage"></a>
你还没有记录。<br><a href="space.php?do=doing&view=me">点击这里用一句记录自己生活的点点滴滴</a>
</div>
<!--{/if}-->
日志的HTM,增加了有无判断,没有不显示。
<!--{if $bloglist}-->
<div id="space_blog" class="feed">
<h3 class="feed_header">
<a href="space.php?uid=$space[uid]&do=blog&view=me" class="r_option">全部</a>
日志
</h3>
<ul class="line_list">
<!--{loop $bloglist $value}-->
<li>
<h4><a href="space.php?uid=$space[uid]&do=blog&id=$value[blogid]">$value[subject]</a></h4>
<div class="detail">
$value[message]
</div>
<p class="stat"><a href="space.php?uid=$space[uid]&do=blog&id=$value[blogid]">阅读全文</a><span class="pipe">|</span><span class="time"><!--{date('m-d H:i',$value[dateline],1)}--></span><span class="pipe">|</span><!--{if $value[replynum]}--><a href="space.php?uid=$space[uid]&do=blog&id=$value[blogid]#comment">$value[replynum]人评论</a><!--{else}--><span class="pipe">没有评论</span><!--{/if}--></p>
</li>
<!--{/loop}-->
</ul>
</div>
<!--{elseif $space[self]}-->
<div>
<h3 class="feed_header">日志</h3>
<div style="padding:10px;">
<a href="cp.php?ac=blog"><img src="image/intro_blog.gif" align="absmiddle"></a>
你还没有日志。<a href="cp.php?ac=blog">点击这里可以写下自己的第一篇日志</a>
</div>
</div>
<!--{/if}--> |