Welcome Guest, Not a member yet? Register   Sign In
Migrating a class to a library
#1

[eluser]sahanlak[/eluser]
Hello I have this class,
Code:
class Cpanel {

    var $user;
    var $password;
    var $domain;
    var $theme;

    function __construct($username='', $password='', $domain='', $theme='x3'){

            //Assign Variables
            $this->user=$username;
            $this->password=$password;
            $this->domain=$domain;
            $this->theme=$theme;

    }


    /*-- Create The Database --*/
    function CreateDB($db){

        $request="/frontend/$this->theme/sql/addb.html?db=$db";
        return $this->check($this->run($request));
    }
  .
  .
  .

So in standard php when I'm creating an object out of this class I pass the username, password etc. But after I make this a library in codeigniter how can I set these initial values ?

Thank you
#2

[eluser]Davide Bellini[/eluser]
Change __construct function in "initialize" function (for example)

In controller :
$this->load->library('cpanel');
$this->cpanel->initialize('user', 'pass', ....);




Theme © iAndrew 2016 - Forum software by © MyBB