[eluser]behnampmdg3[/eluser]
Hello;
Why cant I load views with destructor?
Thanks
Code:
class Members extends CI_Controller {
public $member_id;
public $email;
public function __construct()
{
parent::__construct();
$data['title'] = "Members Page";
$this->load->vars($data);
$this->members();
$this->places();
}
public function index()
{
}
public function members()
{
$this->load->model('members_model');
$data['members'] = $this->members_model->get_all_members();
$this->load->helper('url');
$this->load->vars($data);
}
public function places()
{
$this->load->model('places_model');
$data['places'] = $this->places_model->get_all_places();
$this->load->vars($data);
//$this->output->enable_profiler(TRUE);
}
public function send_email()
{
if(isset($_POST['email']))
{
$this->email = $_POST['email'];
}
$this->load->library('form_validation');
$this->form_validation->set_rules('email','email','required');
$this->load->helper('email');
if (valid_email($this->email))
{
$this->do_send();
}
else
{
$this->show_error();
}
}
public function do_send()
{
$email_valid = true;
send_email($this->email, 'From Codeigniters engine', 'YAY');
$data['form_message'] = "Email has been sent successfully";
$this->load->vars($data);
}
public function show_error()
{
$data['form_message'] = "Invalid Email Address";
$this->load->vars($data);
}
public function view()
{
$this->load->view('header_view');
$this->load->view('members_view');
$this->load->view('footer_view');
}
public function __destruct()
{
$this->view();
}
}