Heim  >  Artikel  >  Backend-Entwicklung  >  PHPCMS 根据栏目放置 加载不同的广告

PHPCMS 根据栏目放置 加载不同的广告

WBOY
WBOYOriginal
2016-07-25 08:48:46838Durchsuche
PHPCMS 根据栏目放置 加载不同的广告
首先要创建一个广告的配置文件,放置在caches/config/ad.php:
  1. //加载广告
  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. }
复制代码
  1. $ad = array();
  2. $ad[1234]=
  3. EOF;
  4. $ad['other']=
  5. EOF;
  6. return $ad;
复制代码


Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn
Vorheriger Artikel:php 创建sprite Nächster Artikel:批量或者单个转换文件编码