例如我要调用网站“积分或金钱”排名前14的会员:
{dede:loop table=’dede_member’ sort=’money’ num=’0′ if=”}
<li>
<span class="ytop">[field:autoindex runphp='yes']$aaa=$GLOBALS['autoindex']++;@me=$aaa-10;[/field:autoindex]</span>
<span class="uname"><a href="/member/index.php?uid=[field:userid/]" target=’_blank’>[field:uname/]</a></span>
<span class="mdetail">[field:scores/] – [field:money/] RMB</span>
</li>
{/dede:loop}
{dede:loop table=’dede_member’ sort=’money’ num=’3′ if=”}
<li>
<span class="ntop">[field:autoindex runphp='yes']$aaa=$GLOBALS['autoindex']++;@me=$aaa-10;[/field:autoindex]</span>
<span class="uname"><a href="/member/index.php?uid=[field:userid/]" target=’_blank’>[field:uname/]</a></span>
<span class="mdetail">[field:scores/] – [field:money/] RMB</span>
</li>
{/dede:loop}
找到文件loop.lib.php,找到 if($if!=”) $ifcase = $if; ,这一句,在其后增加
//////www.ruohai.net
if($num!=”) $num = $num;
//////www.ruohai.net
接着,将 $dsql->SetQuery("Select * From $tablename $ifcase $sort limit 0,$row");
改为
$dsql->SetQuery("Select * From $tablename $ifcase $sort limit $num,$row");
很简单的修改