• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
What kind of type are these classes?

#1
[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,..?

#2
[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.


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.