<?php  
if ($r % 9 == 0 && $show_ads) {
	if($ads == count($adv)) {
	 $ads=0;
	 } else {
	  foreach($adv as $data) {
	     $ad_imgr = $data['ads_img'];
		 $ads_rurl = $data['ads_url'];
		 $ads_durl = $data['ads_durl'];
		 $ads_desr = $data['ads_description'];
		 $ads_tittle = $data['ads_title'];
		 echo '<div class="ads_wrap">
				     <div class="ads_header">
					 <div class="icon-ads icon-bullhorn-1"></div>Sponsored  
					 <div class="ads_icon"><img src="'.$base_url.'css/icons/sponsor.png" class="leftgear"></div>
					 <div class="s_log">s</div>
					 </div>
					 <div class="ads_iw">
					   <div class="ads_">
					   <div class="ads_s_des">'.$ads_desr.'</div>
					    <a href="'.$ads_rurl.'" target="_blank">
					     <div class="ads_ia">
						   <div class="ads_img"><img src="'.$base_url.'uploads/' .$ad_imgr. '"></div>
						   <div class="ads_info_t_l">'.$ads_tittle.'</div>
						   <div class="ads_info_t_l adtstyle">'.$ads_desr.'</div>
						   <div class="ads_info_t_l upcs">'.$ads_durl.'</div>
						 </div>
						  </a>
					   </div>
					 </div>
				   </div>
			  ';
	  $ads = $ads + 1;
		}
     }
   
 } 
?>