Welcome Guest, Not a member yet? Register   Sign In
Creating my own classes and saving files
#1

[eluser]Unknown[/eluser]
Hello everyone
I'm new to CI and MVC and I have a couple of simple questions.

First of all, I would like to know if it makes sense to create classes which do not extend a controller nor a model.
For example, I have a model called settings.
I would like it to have a property called mysettings which will be an array of setting object (which is a regular class).
How would I let the model know of setting's class existence? Where would I store it?


Also, I would like to know where would be a good place to save user uploaded files?

Thanks!
#2

[eluser]imn.codeartist[/eluser]
you can create your own library and place in system/libraries or in system/application/libraries choice is your but please go through the user guide about how to create your library
#3

[eluser]Colin Williams[/eluser]
First, there is no pre-existing model. You don't tell a model anything. You create models. Yes, there is a Model class in CI, but it is more or less an abstract class.

Second, you can create a model without extending the model class. Don't believe me? Try it. The benefit of extending the Model class is that you inherit references to all of CI's existing resources. Otherwise, you just need to reference the core CI class (get_instance()).

There are several ways to be sure CI loads your resource, all of which are detailed in the user guide (hint: they all have something to do with naming the file and class a certain way and putting the file in a certain folder).




Theme © iAndrew 2016 - Forum software by © MyBB