<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Gifts extends CI_Controller {

	function __construct(){
			    parent::__construct();
        	    $this->load->helper('url');
                $this->load->library('session'); //加载session
			    $this->load->model('CsdjDB');
			    $this->load->model('CsdjSkins');
			    $this->load->model('CsdjUser');
	}

	public function index()
	{
                $data='';

			    $data['gifts1']=$this->db->query("select CS_ID,CS_Pic,CS_Name,CS_Cion from ".CS_SqlPrefix."gifts_list where CS_CID=1 order by CS_ID asc")->result();
			    $data['gifts2']=$this->db->query("select CS_ID,CS_Pic,CS_Name,CS_Cion from ".CS_SqlPrefix."gifts_list where CS_CID=2 order by CS_ID asc")->result();
			    $data['gifts']=$this->db->query("select * from ".CS_SqlPrefix."gifts order by CS_AddTime desc limit 20")->result();

                $this->load->get_user_templates();
			    $template=$this->load->view('user-gifts.html',$data,true);

			    $Mark_Text=str_replace("{cscms:title}","积分换礼 - ".Web_Name,$template);
			    $Mark_Text=str_replace("{cscms:keywords}",stripslashes(html_entity_decode(Web_Keywords)),$Mark_Text);
			    $Mark_Text=str_replace("{cscms:description}",stripslashes(html_entity_decode(Web_Description)),$Mark_Text);
		        $Mark_Text=$this->CsdjSkins->Common_Mark($Mark_Text,'');
                $this->CsdjSkins->skins($Mark_Text,$data);
        }
}
