CodeIgniter Forums

Full Version: What kind of type are these classes?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum


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:


$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,..?

El Forum

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.