J'ai transformé une classe PHP normale en une bibliothèque afin de pouvoir l'utiliser dans Codeigniter en tant que bibliothèque. Je peux le charger et appeler les fonctions dont j'ai besoin dans cette classe. Here is that class to help with the question.Appel de fonctions de modèle à partir d'une bibliothèque
Cependant, il y a plusieurs points où je dois appeler des fonctions dans ma classe. Ces fonctions résident dans le modèle qui a instancié ma classe. Comment puis-je faire cela car les appels actuels ne fonctionnent pas normalement. Voici mon 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"];
}
}
Merci à tous pour toute aide.
Parfait - juste ce que je cherchais! – Abs