Home >Backend Development >PHP Tutorial >PHPCMS loads different advertisements based on column placement

PHPCMS loads different advertisements based on column placement

WBOY
WBOYOriginal
2016-07-25 08:48:46898browse
PHPCMS loads different advertisements according to column placement
First, create an advertisement configuration file and place it in caches/config/ad.php:
  1. //Load ads
  2. function ad_block($catid){
  3. $adblocks = pc_base::load_config('ad',$catid);
  4. if(empty($adblocks)){
  5. $model = pc_base::load_model("category_model");
  6. $catid = $model->get_one(array('catid'=>$catid));
  7. $adblocks = pc_base::load_config('ad', $catid['parentid']);
  8. if(empty($adblocks) && $catid['parentid'] != 0){
  9. $adblocks = ad_block($catid['parentid']);
  10. }
  11. if(empty($adblocks)||is_array($adblocks)){
  12. $adblocks = pc_base::load_config('ad','other');
  13. }
  14. }
  15. return $adblocks;
  16. }
Copy code
  1. $ad = array();
  2. $ad[1234]=<<
  3. < script type="text/javascript" >BAIDU_CLB_SLOT_ID = "XXXXX";
  4. EOF;
  5. $ad['other']=<<