Okay, folks I am working on private / personal project. It involves the use of IPBWI (Which is a web integration for IPBoard and a website that is using the codeigniter framework for the heavy lifting.
My problem is first of IPBWI and CodeIgniter don't play along in the method that I need them to. As such I have two options. Use IPBWI on each php code page that I need it on (which is a lot, and it will be called several times as it is unable to pass class to class, page to page, etc). The other is to create an 'interface' class/library that I can use directly with CodeIgniter so I can use the pre-built systems of handling a typical class.
What I am running into an issue creating the interface library/class. What I am trying to do is general Class Inheritance. In the main class ips_conversion I define the 'sub classes' that match to the IPBWI. This way I can use the following in any of my other pages
PHP Code:
$this->ips_conversion->members->login($params)
Which would translate to
Class :: ips_conversion
Sub Class :: members
Function :: login
I am trying to get it so I can call the main class, and in that method call the sub class with the required function.
Current setup example
PHP Code:
class Ips_conversion{
/*
Function __construct() details
Loads all 'child' classes
*/
public $member; // Members Child Class
function __construct(){
$this->CI =& get_instance();
$this->member = new member($this);
}
}
class member extends Ips_conversion{
function __construct(){
include("/home/me2legion/public_html/includes/ips_sdk/ipbwi.inc.php");
$this->IPS = new ipbwi();
}
function login($usr, $pwd, $cookie = true, $anon = false){
$UID = $this->name2id($usr);
if($this->IPS->member->login($UID,$pwd,$cookie,$anon,$usr,$pwd) == TRUE){
return TRUE;
}
else{
return FALSE;
}
}
function logout(){
if($this->IPS->member->logout() == TRUE){
return TRUE;
}
else{
return FALSE;
}
}
function name2id($name,$array = false){
if($array == false){
return $this->IPS->member->name2id($name);
}
else{
return $this->IPS->member->name2id($array);
}
}
function isLoggedIn($uid = false){
return $this->IPS->member->isLoggedIn($uid);
}
function isAdmin($uid = false){
return $this->IPS->member->isAdmin($uid);
}
function info($uid = false){
return $this->IPS->member->info($uid);
}
}
In my browser I get the following
Code:
Fatal error: Call to a member function isLoggedIn() on a non-object
Using the following line to call it
PHP Code:
$this->Ips_conversion->member->isLoggedIn();
TIA Jon
__________________
AMW_Drizz
Dev Machine:: Apache 2.2.6 PHP 5.2.6 MySQL 5.1
Last edited by amw_drizz; 11-26-2010 at 12:26 PM..
Reason: resolved
|