thinkCMF----调用幻灯片

还是在Common.php上写:

/*
 * slide 获取幻灯片
 * 具体使用:
 <?php $slide = slide();?>
 <foreach name="slide" item="v">
 <img src="__ROOT__/upload/{$v['image']}">            
 </foreach>
 */
function slide($slide_id = 1){
    $where = array();
    $where['slide_id'] = 1;
    $where['status'] = 1;
    $slide = Db::name('slide_item')->where($where)->select();
    return $slide;
}

具体调用:

<?php $slide = slide();?>
<foreach name="slide" item="v">
<li class='con' style="display:inline; background:url('__ROOT__/upload/{$v['image']}') no-repeat center center;"></li>                
</foreach>

猜你喜欢

转载自www.cnblogs.com/e0yu/p/9540983.html