Welcome Guest, Not a member yet? Register   Sign In
Custom library question, for clarification?
#1

[eluser]whygod[/eluser]
Hi

I just want to clarify my understanding.
Okay the User Manual says, to utilize CodeIgniter Resources within a Library.
I need to do it like this below,

Code:
$CI =& get_instance();

$CI->load->helper('url');
$CI->load->library('session');
$CI->config->item('base_url');

So meaning when extending the MY_Controller below is not right?
MY_Controller:
Code:
<?php
if (! defined('BASEPATH')) exit('No direct script access allowed');

class MY_Controller extends CI_Controller
{
public $data = array();

    function __construct ()
    {
        parent::__construct();
  
        $this->load->helper('url');
        $this->load->helper('form');
        $this->load->library('form_validation');  
        $this->load->library('jaz_lib');
    }
}

Custom library: Jaz_lib.php
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;  
}
    
}

Meaning the classes that was loaded in the MY_Controller,
will not be inherited in Jaz_lib library?

Thanks in advanced.



Messages In This Thread
Custom library question, for clarification? - by El Forum - 11-07-2012, 03:59 AM
Custom library question, for clarification? - by El Forum - 11-07-2012, 04:14 AM
Custom library question, for clarification? - by El Forum - 11-07-2012, 05:45 AM



Theme © iAndrew 2016 - Forum software by © MyBB