Welcome Guest, Not a member yet? Register   Sign In
question about libraries..
#1

[eluser]mangpeps[/eluser]
Guys. I tried to create one libraries and it was successful. Problem is when I tried to return variables from the MASTER_Controller libraries, I can't use it. Here is the code. I wounld like to u
se the $header variables in all of my controllers that. Pls help

Code:
<?php
class MASTER_Controller extends Controller{

    //public $globaldata['helloworld'] = "THIS STRING IS AVAILABLE TO ANY PAGES";

    function MASTER_Controller(){
         parent::Controller();
             //$this->load->library('encrypt');
            $this->load->library('session');
    }
    
    function master_login($username,$password){
        
        
        
                $header['headlog']=null;
        
              $header['headlogout']=$this->sessioncheck();
    $header['headlogout']=TRUE;    
    
        return $header;
}
#2

[eluser]InsiteFX[/eluser]
The name is MY_Controller not MASTER_Controller unless you change it
in the config file.

InsiteFX
#3

[eluser]mangpeps[/eluser]
Yeah. I changed it in the config file. You did not give me the answer, how can I call the variable from the library ?
#4

[eluser]danmontgomery[/eluser]
Code:
class MASTER_Controller extends Controller {

    var $foo = 'bar';

    function MASTER_Controller() {
        parent::Controller();
    }

}

class Example extends MASTER_Controller {

    function index() {
        echo $this->foo; // bar
    }

}
#5

[eluser]CI_avatar[/eluser]
you may access your library variable this way.
$this->load->library('mylibrary');
$this->mylibrary->mylibraryvariable;




Theme © iAndrew 2016 - Forum software by © MyBB