Welcome Guest, Not a member yet? Register   Sign In
Creating library?
#1

[eluser]whygod[/eluser]
Okay I created my own library below,
also extended MY_Controller.
Code:
<?php
if (! defined('BASEPATH')) exit('No direct script access allowed');

class Jaz_lib extends MY_Controller
{
public $data = array(
                   '' => '',
    );
    function __construct ()
    {
        parent::__construct();
    }

    public function logout()
    {
//Destroy session
$this->session->sess_destroy();
  
//Delete coockie
return TRUE;  
    }
}

Just want to know if I'm doing it right?




#2

[eluser]whygod[/eluser]
And in my controller I called it like this,
Code:
$this->jaz_lib->logout();

Am I doing it right?
#3

[eluser]CroNiX[/eluser]
No. Libraries are standalone classes. They don't extend anything (like a controller extends CI_Controller and a model extends CI_Model) unless you are extending a core CI class (which you aren't)




Theme © iAndrew 2016 - Forum software by © MyBB