yingyes
By: a guest | Apr 4th, 2008 | Syntax:
None | Size: 1.15 KB | Hits: 147 | Expires: Never
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
class Home extends Module
{
function Home()
{
parent::Module();
$this->init();
}
function index($_data)
{
if($_data['current_action']=='contact' && method_exists($this,'contact'))
{
$this->contact($_data);
}
$data = array(
'current_page'=>$_data['current_page'],
'current_action'=>$_data['current_action'],
'page_title'=>site_url()
);
$data=array_merge($data,$_data);
return $this->render($data);
}
function init()
{
if($this->uri->segment(2)!='init')
{
$this->method = ($this->uri->segment(2)!=''&&function_exists($this->uri->segment(2))) ? $this->uri->segment(2) : 'index';
}
else
{
$this->_error();
}
}
function render($data,$template='tpl_index')
{
return ($this->uri->segment(2)!='render')?$this->smarty_parser->parse('ci:'.$this->environ->template.$template,$data,true):$this->_error();
}
function _error($to='',$message='')
{
$this->session->set_flashdata('error',$message);
redirect($to);//echo 'ERROR 404';
}
}
?>