1. 程式人生 > >dedecms sql 自定義模型 多表查詢

dedecms sql 自定義模型 多表查詢

 副表:wl_addon18,wl_addon17;

主表:wl_archives

{dede:sql sql="select wl_archives.*,wl_archives.litpic, wl_archives.title,wl_addon18.style,wl_addon18.jushi,wl_addon18.diqu,wl_addon18.mianji,wl_addon18.diqu from (wl_addon18 left join wl_archives on wl_addon18.aid = wl_archives.id) left join wl_addon17 on wl_addon17.name = ~name~ where wl_addon18.name=~name~"}  
      <div class="item">
        <a href="[field:id runphp='yes']$arcRow=GetOneArchive(@me);@me=$arcRow['arcurl'];[/field:id]" rel="nofollow">
						<div class="pic pr lazy">
							<img  src="http://www.lohas-future.com/[field:litpic/]" alt="[field:title/]" class="lazy_img auto">
							<span class="picNum pa"><i class="icon icon-tupian"></i> <span class="num">0</span></span>
						</div>
						<div class="info pr">
							<p class="name"><h2>[field:title/]</h2></p>
							<p class="tag"><a href="[field:id runphp='yes']$arcRow=GetOneArchive(@me);@me=$arcRow['arcurl'];[/field:id]">[field:jushi/]</a>| <a href="[field:id runphp='yes']$arcRow=GetOneArchive(@me);@me=$arcRow['arcurl'];[/field:id]">[field:style/] </a>|<a href="[field:id runphp='yes']$arcRow=GetOneArchive(@me);@me=$arcRow['arcurl'];[/field:id]">[field:mianji/]平</a></p>
        <p class="zan pa " id="134067"><i class="icon icon-zan"></i> <span class="num">0</span></p>
      </div>
      </a>
    </div>
    {/dede:sql}