Calling Model Functions from a Library
- by Abs
Hello all,
I have turned a normal PHP class into a library so I can use it in Codeigniter as a library. I can load it and call the functions I need in that class. Here is that class to help with the question.
However, there are quite a few points where I have to call functions in my class. These functions reside in the model that instantiated my class. How can I do this as currently normal calls don't work. Here is my code:
class Controlpanel_model extends Model {
var $category = '';
var $dataa = 'a';
function Controlpanel_model(){
parent::Model();
}
function import_browser_bookmarks(){
$this->load->library('BookmarkParser');
/*
*In this function call to the class I pass
* what model functions exist that it should call
* You can view how this done by clicking the link above and looking at line 383
*/
$this->bookmarkparser->parseNetscape("./bookmarks.html", 0, 'myURL', 'myFolder');
return $this->dataa;
}
function myURL($data, $depth, $no) {
$category = $this->category;
$this->dataa .= 'Tag = '.$category.'<br />'.'URL = '.$data["url"].'<br />'.'Title = '.$data["descr"].'<br />'.'<br /><br />';
}
function myFolder($data, $depth, $no) {
$this->category = $data["name"];
}
}
Thanks all for any help.