CodeIgniter Forums
What kind of type are these classes? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: What kind of type are these classes? (/thread-24299.html)



What kind of type are these classes? - El Forum - 11-05-2009

[eluser]Unknown[/eluser]
Hi!

I'm new to CI and started therefor a simple project.
In my project I'm trying to parse a directory to my class structure.
something like that:

Code:
...

$folder = new Folder();
foreach($files as $file)
{
  if(is_dir($file)) {
    $folder->add(new Folder($file));
  }
  else if (is_file($file)) {
    $folder->add(new File($file));
  }
  ...
}
...

I guess i dont understand what kind of Class (eg library, helper, models(only for db?)) is what for.
What kind of classes are Folder and File?
Are they Helper, Library,..?


What kind of type are these classes? - El Forum - 11-05-2009

[eluser]BrianDHall[/eluser]
A helper is not a class, just a collection of functions that can be used independently of any objects.

A library is what you are looking for, it's the term for where you store your own created class files and such.

A model involves application data - storing, retrieving, processing the 'state' of an application.

So you'd stick your desired classes in libraries folder in the application directory and load them in a constructor with $this->load->library() calls.