<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/**
 * Feed
 * @author		Jade Xia
 * @copyright	Copyright (c) 2010 - 2011 天夏网络.
 * @link		http://www.tianxianet.com
 */
class Feed extends Controller
{
	
	function Feed()
	{
		parent::Controller();
		$this->load->database();
		$this->load->model('com_model');
	}
	
	function ads($id = 0)
	{
		if( ! $id) return ;
		$query = $this->db->get_where('shop_ads',array('id'=>$id));
		if($query->num_rows() > 0)
		{
			$row = $query -> row();
		}
		if(isset($row))
		{
			if($row -> is_pic == 1)
			{
				$str = $this->load->view(TPL_FOLDER.'ads_img',array('ads'=>$row),true);
				header("Content-Type:application/x-javascript;charset=utf-8");
				echo "document.write('{$str}');";
			}
			else
			{
				$str = $this->load->view(TPL_FOLDER.'ads_flash',array('ads'=>$row),true);
				header("Content-Type:application/x-javascript;charset=utf-8");
				echo "document.write('{$str}');";
			}
		}
	}
}
?>