PHPCMS loads different advertisements according to column placement First, create an advertisement configuration file and place it in caches/config/ad.php:
- //Load ads
-
- 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;
-
- }
Copy code
- $ad = array();
-
- $ad[1234]=<<
-
- < script type="text/javascript" >BAIDU_CLB_SLOT_ID = "XXXXX";
-
-
- EOF;
-
-
- $ad['other']=<<
|