Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- if (!defined('BASEPATH')) exit('No direct script access allowed');
- function get_zona_detail($name){
- $obj =& get_instance();
- $template = $obj->template->get('name');
- $r = $obj->db->select()->from('banner_position')->where(array('posname' => $name, 'template' => $template))->get();
- return $r->row();
- }
- function show_banner($position){
- $obj =& get_instance();
- $obj->load->model('Banner_model', 'bnr', 'banner');
- $zone = get_zona_detail($position);
- $bnrs = $obj->bnr->get($position, $zone->maximum == 0 ? '':$zone->maximum);
- ?>
- <div class="banner-info">Sponsor kami</div>
- <div class="banner-content">
- <?php
- $row = count($bnrs);
- foreach( $bnrs as $i => $bnr ):
- ?>
- <div class="banner-item">
- <?php
- if( is_file(ROOTPATH.'images/bnrs/'.$bnr->image) ){
- if( $bnr->filetype == 'application/x-shockwave-flash' ){
- $size = getimagesize(ROOTPATH.'images/bnrs/'.$bnr->image);
- $image = '<object type="application/x-shockwave-flash" data="'.base_url().'images/bnrs/'.$bnr->image.'" width="'.$size[0].'" height="'.$size[1].'">
- <param name="movie" value="'.base_url().'images/bnrs/'.$bnr->image.'" />
- <param name="menu" value="false" />
- </object>';
- } else {
- $image = '<img src="'.base_url().'images/bnrs/'.$bnr->image.'" alt="" />';
- }
- if( $bnr->link != '' && $bnr->link != '#' && $bnr->link != 'http://' ){
- ?>
- <a href="<?=site_url2('banner/click/'.$bnr->id.'-'.url_title($bnr->link));?>"<?=($bnr->target=='new' || empty($bnr->target)) ? ' target="_blank"':'';?> rel="nofollow"><?=$image;?></a>
- <?php
- } else {
- ?>
- <a href="javascript:void(null);" onclick="this.blur();"><?=$image;?></a>
- <?php
- }
- } elseif( $bnr->bannercode != '' ){
- ?>
- <?=$bnr->bannercode;?>
- <?php
- }
- ?>
- <!--<br /><small>Exp. Date: <?=mdate('%d-%M-%Y', gmt_to_local($bnr->enddate, config_item('time_zone')));?></small>-->
- </div>
- <?php endforeach; ?>
- <?php
- $countdef = $zone->maximum - $row;
- //$countdef = ($countdef < 0 || $zone->maximum==0) ? 1:$countdef;
- //for( $z=0; $z<$countdef; $z++ ):
- //if( $countdef != 0 ):
- if( ($zone->maximum == 0 || $countdef != 0) && is_file(ROOTPATH.'images/bnrs/'.$zone->bannerspaceimg) ):
- $image = '<img src="'.base_url().'images/bnrs/'.$zone->bannerspaceimg.'" alt="" />';
- ?>
- <div class="banner-item"><a href="<?php echo site_url2('banner/pasang'); ?>" onclick="this.blur();"><?=$image;?></a></div>
- <?php
- endif;
- //endif;
- //endfor;
- ?>
- </div>
- <?php
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement