Advertisement
Guest User

Untitled

a guest
Feb 21st, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.52 KB | None | 0 0
  1. <?php
  2. if (!defined('BASEPATH')) exit('No direct script access allowed');
  3.  
  4. function get_zona_detail($name){
  5.     $obj =& get_instance();
  6.     $template = $obj->template->get('name');
  7.     $r = $obj->db->select()->from('banner_position')->where(array('posname' => $name, 'template' => $template))->get();
  8.    
  9.     return $r->row();
  10. }
  11.  
  12. function show_banner($position){
  13.     $obj =& get_instance();
  14.     $obj->load->model('Banner_model', 'bnr', 'banner');
  15.     $zone = get_zona_detail($position);
  16.     $bnrs = $obj->bnr->get($position, $zone->maximum == 0 ? '':$zone->maximum);
  17.     ?>
  18.     <div class="banner-info">Sponsor kami</div>
  19.     <div class="banner-content">
  20.         <?php
  21.         $row = count($bnrs);
  22.         foreach( $bnrs as $i => $bnr ):
  23.         ?>
  24.         <div class="banner-item">
  25.             <?php
  26.             if( is_file(ROOTPATH.'images/bnrs/'.$bnr->image) ){
  27.                 if( $bnr->filetype == 'application/x-shockwave-flash' ){
  28.                     $size = getimagesize(ROOTPATH.'images/bnrs/'.$bnr->image);
  29.                     $image = '<object type="application/x-shockwave-flash" data="'.base_url().'images/bnrs/'.$bnr->image.'" width="'.$size[0].'" height="'.$size[1].'">
  30.                         <param name="movie" value="'.base_url().'images/bnrs/'.$bnr->image.'" />
  31.                         <param name="menu" value="false" />
  32.                         </object>';
  33.                 } else {
  34.                     $image = '<img src="'.base_url().'images/bnrs/'.$bnr->image.'" alt="" />';
  35.                 }
  36.                 if( $bnr->link != '' && $bnr->link != '#' && $bnr->link != 'http://' ){
  37.                 ?>
  38.                     <a href="<?=site_url2('banner/click/'.$bnr->id.'-'.url_title($bnr->link));?>"<?=($bnr->target=='new' || empty($bnr->target)) ? ' target="_blank"':'';?> rel="nofollow"><?=$image;?></a>
  39.                 <?php
  40.                 } else {
  41.                 ?>
  42.                 <a href="javascript:void(null);" onclick="this.blur();"><?=$image;?></a>
  43.                 <?php
  44.                 }
  45.             } elseif( $bnr->bannercode != '' ){
  46.                 ?>
  47.                 <?=$bnr->bannercode;?>
  48.                 <?php
  49.             }
  50.         ?>
  51.         <!--<br /><small>Exp. Date: <?=mdate('%d-%M-%Y', gmt_to_local($bnr->enddate, config_item('time_zone')));?></small>-->
  52.         </div>         
  53.         <?php endforeach; ?>
  54.         <?php
  55.         $countdef = $zone->maximum - $row;
  56.         //$countdef = ($countdef < 0 || $zone->maximum==0) ? 1:$countdef;
  57.         //for( $z=0; $z<$countdef; $z++ ):
  58.         //if( $countdef != 0 ):
  59.         if( ($zone->maximum == 0 || $countdef != 0) && is_file(ROOTPATH.'images/bnrs/'.$zone->bannerspaceimg) ):
  60.             $image = '<img src="'.base_url().'images/bnrs/'.$zone->bannerspaceimg.'" alt="" />';
  61.             ?>
  62.             <div class="banner-item"><a href="<?php echo site_url2('banner/pasang'); ?>" onclick="this.blur();"><?=$image;?></a></div>
  63.             <?php
  64.         endif;
  65.         //endif;
  66.         //endfor;
  67.         ?>
  68.     </div>
  69.     <?php
  70. }
  71. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement