[eluser]tonanbarbarian[/eluser]
if we make an instance of CI in the constructor of the library we can do anything
Code:
<?php
if (!defined('BASEPATH')) exit('No direct script access allowed');
class sms {
var $CI = null;
function sms() {
if ($this->CI===null)
$CI =& get_instance();
} // sms()
function background() {
$fp = fsockopen("www.example.com", 80, $errno, $errstr, 30);
if (!$fp) {
log_message('error', 'Unable to connect to server');
return;
}
$request = "GET /SendSMS/index HTTP/1.1\r\n"
."Host: www.example.com\r\n"
."Connection: Close\r\n\r\n";
fwrite($fp, $request);
fclose($fp);
} // background()
function query() {
$this->CI->db->query();
...
}
} // class sms
So if you want to call anything you could in the controller use $this->CI->... rather than $this->...