CodeIgniter Forums
Class 'CI_Model' not found - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Class 'CI_Model' not found (/showthread.php?tid=53614)



Class 'CI_Model' not found - El Forum - 07-31-2012

[eluser]Unknown[/eluser]
Sorry for french comments, it's for school. when I try to load the page who include() this code file it gives me this error:

Quote:Fatal error: Class 'CI_Model' not found in C:\Users\plcoterivard\Dropbox\weblocal\CI\application\models\gestionArticle.php on line 4

Line four is:
Code:
class GestionArticle extends CI_Model{

Code:
<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');//Pas d'accès direct à ce fichier.

//Ce modèle est utilisé pour écrire l'objet dans un fichier.
class GestionArticle extends CI_Model{

//Source du fichier txt qui contien l'article.
private $fichier = 'application/models/article.txt';

public function __construct(){
  include('classArticle.php');//Modèle générant l'objet.
  //L'objet est créé dans classArticle.php.
  //Pour cette raison, je ne le construis pas ici.
}
public function Ajouter($titre, $texte){
  $a = new Article($titre, $texte);//Crée une nouvel objet Article.
  $ressource = fopen($this->fichier,"w");//Ouvre le fichier en écriture "écrasante".
  fwrite($ressource, serialize($a) . "\r\n");//Sérialise l'objet et l'enregistre.
  fclose($ressource); //Ferme le fichier.
  echo $a->$titre . '<br /><br />' . $m->$texte;//Pour tester la lecture d'objet.
}
/*
public function lire(){
  $liste = "<ul>";
  if ($arrfichier = file($this->fichier)) {
   foreach($arrfichier as $ligne){
    $m = unserialize($ligne);
    $liste .= '<li>' . $m->getPrenom() . ' ' .
         $m->getNom() . '</li>';
   }
  }
  $liste .= "</ul>"; // $liste = $liste .  "</ul>";
  return $liste;
}
*/
}
?&gt;

Tank you for your help