Naming / referring to controllers and models |
Maybe I'm missing something basic but I've found conflicting information in many different places on this. Varioius tutorials and videos seem to reference models and controllers with either lower case or upper case names freely. I've done both when trying to follow these examples and haven't noticed any errors associated with how I use names. And I haven't seen any explanation for why it's necessary or what terrible things happen if you violate this often mandated practice.
Take Codeigniter's own documentation. In https://www.codeigniter.com/userguide2/g...odels.html Under loading the model it says: Your models will typically be loaded and called from within your controller functions. To load a model you will use the following function: Code: $this->load->model('Model_name'); Here, Model_name is capialized. Understandable because that is its name. Then they say: If your model is located in a sub-folder, include the relative path from your models folder. For example, if you have a model located at application/models/blog/queries.php you'll load it using: Code: $this->load->model('blog/queries'); So, are they saying if it's in a subdirectory then you reference the model with its filename minus the extension? But if it's not in a subdirectory then you reference it by it's object name? That seems unlikely. But like I said I might be missing something very basic. Any help appreciated. |
Welcome Guest, Not a member yet? Register Sign In |