名称: slide_data
参数: slide_data($category='')
功能: 读取轮播图列表,可以传入指定分类读取分类下的数据
调用示例:
<div class="content-slider"> {ephp}$_slide_data = EsiteApp::app()->slide_data('home-bottom-ads');{/ephp} <div id="myCarousel" class="carousel slide" data-ride="carousel"> <!-- Indicators --> {if($_slide_data)} <ol class="carousel-indicators"> {loop $_slide_data $k1 $v1} <li data-target="#myCarousel" data-slide-to="{$k1}" class="{ephp}echo $k1==0?'active':'';{/ephp}"></li> {/loop} </ol> <div class="carousel-inner"> {loop $_slide_data $k1 $v1} <div class="item {ephp}echo $k1==0?'active':'';{/ephp}"><img src="{$v1['img']}" class="img-responsive" alt="{$v1['name']} {$v1['notes']}"></div> {/loop} </div> {/if} </div> </div>
数据格式参考:
Array ( [0] => Array ( [id] => 1 [name] => 本月新品推荐 [url] => [img] => /esite_static/image/2018052818570148.jpg [category] => home-bottom-ads [sort] => 0 [notes] => ) [1] => Array ( [id] => 2 [name] => 本月新品推荐 [url] => [img] => /esite_static/image/2018052818571726.jpg [category] => home-bottom-ads [sort] => 0 [notes] => ) [2] => Array ( [id] => 3 [name] => 本月新品推荐 [url] => [img] => /esite_static/image/2018052818572981.jpg [category] => home-bottom-ads [sort] => 0 [notes] => ) )