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

class Index extends CI_Controller {

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

	public function index()
	{
	    $cache_id ="user_index";
	    if(!($this->CsdjCache->start($cache_id))){
                $data='';
                $this->load->get_user_templates();
		$template=$this->load->view('user-index.html',$data,true);
		$template=$this->CsdjSkins->TopandBottom($template,'user');

		$Mark_Text=str_replace("{cscms:title}","音乐广场",$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,1);
                if($this->CsdjUser->User_Login(1)){ //已经登入
	           $row=$this->CsdjDB->get_select ('user','CS_ID','*',''.$this->session->userdata('cs_id').'');
		   $Mark_Text=$this->CsdjUser->getuser($Mark_Text,$row);
                }
                $this->CsdjSkins->skins($Mark_Text,$data);
		$this->CsdjCache->end();
	    }
        }
}

