研究了一下,记录的PHP(space_doing.php)和模版(space_doing.htm),
数据是可以调用出来了。但是直接显示了50条
求大神帮忙加个控制条数的代码,我只想显示6条。谢谢啦!
php:
- $dolist = array();
- $count = 0;
- if(empty($count)) {
- $count = C::t('home_doing')->fetch_all_search($start, $perpage, 3, $uids, '', $searchkey, '', '' ,'', 1, $doid, $f_index);
- }
- if($count) {
- $query = C::t('home_doing')->fetch_all_search($start, $perpage, 1, $uids, '', $searchkey, '', '' ,'', 1, $doid, $f_index);
- foreach($query as $value) {
- if($value['status'] == 0 || $value['uid'] == $_G['uid'] || $_G['adminid'] == 1) {
- $doids[] = $value['doid'];
- $dolist[] = $value;
- } else {
- $pricount ++;
- }
- }
- }
复制代码 模版:
- <!--{if $dolist}-->
- <!--{loop $dolist $value}-->
- <dl class="cl">
- <dd class="m"><a href="home.php?mod=space&uid=$value[uid]"><img src="uc_server/avatar.php?uid=$value[uid]&size=small" width="48" height="48" alt="$value[username]" /></a></dd>
- <dt><a href="home.php?mod=space&uid=$value[uid]" title="$value[username]">$value[username]</a> <em class="xg1 xw0"><!--{date($value['dateline'], 'H:i')}--></em></dt>
- <dd><a href="home.php?mod=space&uid=$value[uid]&do=doing&doid=$value[doid]">$value[message]</a></dd>
- </dl>
- <!--{/loop}-->
- <!--{/if}-->
复制代码
|