thinkphp 有没有类似smarty {insert name="funs"...}

浏览:998 发布日期:2013/06/01 分类:求助交流
thinkphp 有没有类似smarty {insert name="funs" ...}
function insert_banner($params,&$smarty){

$db = Db::init();
$sql = "SELECT * FROM ".TABLE_BANNERS."
WHERE status = 1 AND (start_time < now() or start_time = '0000-00-00 00:00:00')
AND (expires_time > now() or expires_time = '0000-00-00 00:00:00')";

$id = (int)$params['bid'];
if(!empty($id)){

$condition = " AND banner_id = '{$id}'";
}elseif(!empty($params['group'])){

$condition = " AND group_name = '{$params['group']}'";
}else{
$smarty->trigger_error('fckeditor: required parameter "id" or "group" missing');
}

$sql .= $condition." ORDER BY sort_order ASC,banner_id DESC ";

if(!empty($id))
$banners = $db->getOne($sql);
else $banners = $db->getAll($sql);
return $banners;
}



模板中调用{insert name="banner" id="" group="" assign="banner"}这样的样式插入广告条
最佳答案
评论( 相关
后面还有条评论,点击查看>>