PHPCMS 根据栏目放置 加载不同的广告 首先要创建一个广告的配置文件,放置在caches/config/ad.php:
- //加载广告
-
- function ad_block($catid){
-
- $adblocks = pc_base::load_config('ad',$catid);
-
- if(empty($adblocks)){
-
- $model = pc_base::load_model("category_model");
-
- $catid = $model->get_one(array('catid'=>$catid));
-
- $adblocks = pc_base::load_config('ad',$catid['parentid']);
-
-
-
- if(empty($adblocks) && $catid['parentid'] != 0){
-
- $adblocks = ad_block($catid['parentid']);
-
- }
-
-
-
- if(empty($adblocks)||is_array($adblocks)){
-
- $adblocks = pc_base::load_config('ad','other');
-
- }
-
- }
-
- return $adblocks;
-
- }
复制代码
- $ad = array();
-
- $ad[1234]=<<
-
-
-
- EOF;
-
-
- $ad['other']=<<
-
-
-
- EOF;
-
-
- return $ad;
复制代码
|