UCenter Home常用sql语句高级篇(二)

1、UCenter Home活跃会员SQL语句:

SELECT * FROM `uchome_space` AS `space` LEFT JOIN `uchome_spacefield` AS `spacefield` on `space`.`uid`=`spacefield`.`uid` WHERE `space`.`avatar`='1' ORDER BY `space`.`credit` DESC

变量名uchnumber,对应模板内容如下:

<ul>
<!--{loop $_SBLOCK['uchnumber'] $value}-->
<li>
<a href="space.php?uid=$value[uid]" target="_blank"><!--{avatar($value[uid],small)}--></a>
<p><a href="space.php?uid=$value[uid]" target="_blank">$value[username]</a></p>
</li>
<!--{/loop}-->
</ul>

2、动态查询SQL语句:

SELECT * FROM `uchome_feed` AS `feed` WHERE `feed`.`appid`='0' AND `feed`.`friend`='0' ORDER BY `feed`.`dateline` DESC

变量名uchfeed,对应模板内容如下:

<!--{eval $feed_list = array();}-->
<!--{loop $_SBLOCK['uchfeed'] $value}-->
        <!--{if empty($feed_list[$value['hash_data']][$value['uid']])}-->
                <!--{eval realname_set($value['uid'], $value['username']);}-->
                <!--{eval $feed_list[$value['hash_data']][$value['uid']] = $value;}-->
        <!--{/if}-->
<!--{/loop}-->

<!--{eval $list = array();}-->
<!--{loop $feed_list $values}-->
        <!--{eval $actors = array();}-->
        <!--{eval $a_value = array();}-->
        <!--{loop $values $value}-->
                <!--{if empty($a_value)}-->
                        <!--{eval $a_value = $value;}-->
                <!--{/if}-->
                <!--{eval $actors[] = "<a href=\"{$siteurl}space.php?uid=$value[uid]\">".$_SN[$value['uid']]."</a>";}-->
        <!--{/loop}-->
        <!--{eval $a_value = mkfeed($a_value, $actors);}-->
        <!--{if $a_value['dateline']>=$_SGLOBAL['today']}-->
                <!--{eval $list['today'][] = $a_value;}-->
        <!--{elseif $a_value['dateline']>=$_SGLOBAL['today']-3600*24}-->
                <!--{eval $list['yesterday'][] = $a_value;}-->
        <!--{else}-->
                <!--{eval $theday = sgmdate('Y-m-d', $a_value['dateline']);}-->
                <!--{eval $list[$theday][] = $a_value;}-->
        <!--{/if}-->
<!--{/loop}-->

<!--{loop $list $day $values}-->
<UL id="scrollbody">
<!--{loop $values $value}-->
<li id="feed_$value[feedid]_li">
                <!--{eval echo str_replace('src="attachment', 'src="'.$siteurl.'attachment', str_replace('ref="space', 'ref="'.$siteurl.'space', $value[title_template]));}-->
                <!--{if empty($notime)}--> <span><!--{date('m-d H:i',$value[dateline],1)}--></span><!--{/if}-->
</li>
<!--{/loop}-->
</ul>
<!--{/loop}-->

相关文章:

1、UCenter Home实战sql语句数据调用篇(三)
https://www.onexin.net/ucenter-home-actual-sql-statement-that-the-data-is-called-articles-3/

2、UCenter Home常用sql语句入门篇(一)
https://www.onexin.net/used-sql-statement-ucenter-home-getting-started-chapter/

3、UCenter Home二次开发指南
https://www.onexin.net/ucenter-home-secondary-development-guide/

4、创建 PDO 实例请求连接SQL数据库
https://www.onexin.net/pdo-database/

5、数据库设计中的英文术语表
https://www.onexin.net/english-glossary-database-design/

转载请注明出处:https://www.onexin.net/commonly-used-sql-statement-ucenter-home-advanced-articles/

Leave a Reply

Your email address will not be published. Required fields are marked *