17:19:21 function get_adv($type,$id) { $sql = "select ap.ad_width,ap.ad_height,ad.ad_name,ad.ad_code,ad.ad_link from ".$GLOBALS['ecs']->table('ad_position')." as ap left join ".$GLOBALS['ecs']->table('ad')." as ad on ad.position_id = ap.position_id where ad.ad_name='".$type."_".$id."' and ad.media_type=0 and UNIX_TIMESTAMP()>ad.start_time and UNIX_TIMESTAMP()<ad.end_time and ad.enabled=1"; $res = $GLOBALS['db']->getRow($sql); if($res) return "<a href='".$res['ad_link']."' target='_blank'><img src='data/afficheimg/".$res['ad_code']."' width='".$res['ad_width']."' height='".$res['ad_height']."' /></a>"; else { return ""; } } /* *获取某广告位名称的广告列表 */ function get_cat_advlist($position) { $arr=array(); $sql = "select ap.ad_width,ap.ad_height,ad.ad_name,ad.ad_code,ad.ad_link,ad.ad_id from ".$GLOBALS['ecs']->table('ad_position')." as ap left join ".$GLOBALS['ecs']->table('ad')." as ad on ad.position_id = ap.position_id where ap.position_name='".$position."' and ad.media_type=0 and UNIX_TIMESTAMP()>ad.start_time and UNIX_TIMESTAMP()<ad.end_time and ad.enabled=1"; $res = $GLOBALS['db']->getAll($sql); foreach($res as $idx => $row) { $arr[$row['ad_id']]['name'] = $row['ad_name']; $arr[$row['ad_id']]['content'] = "<a href='".$row['ad_link']."' target='_blank'><img src='data/afficheimg/".$row['ad_code']."' width='".$row['ad_width']."' height='".$row['ad_height']."' /></a>"; } return $arr; } |
17:19:55 <?php echo get_adv("ad","1");?></div> |
17:30:19 function fetch_str($source) { if (!defined('ECS_ADMIN')) { $source = $this->smarty_prefilter_preCompile($source); } return preg_replace("/{([^\}\{\n]*)}/e", "\$this->select('\\1');", $source); } |