模板中执行sql语句 直接查询数据库
<!--SELECT sid,aid,name,subname,avgsort,thumb,description FROM modoer_subject WHERE finer>0 AND status=1 ORDER BY finer DESC LIMIT 0,10-->
{get:modoer val=table(table/dbpre_subject/select/sid,aid,name,subname,avgsort,thumb,description/where/finer>0 AND status=1/orderby/finer DESC/rows/10/cachetime/1000)}
<li>
<div><a href="{url item/detail/id/$val[sid]}"><img src="{URLROOT}/{if $val[thumb]}$val[thumb]{else}static/images/noimg.gif{/if}" alt="$val[name].$val[subname]" title="$val[name].$val[subname]" /></a></div>
<p><a href="{url item/detail/id/$val[sid]}" title="$val[name].$val[subname]">{sublen $val[name].$val[subname],10}</a></p>
</li>
{/get}
标签:status,10,val,modoer,sql,table,模板,finer From: https://blog.51cto.com/u_2148212/7227483