using $this->load->model on Modular Extensions fails |
[eluser]moksahero[/eluser]
Hello, I'm having trouble loading model using Modular Extensions. The way I was trying was to use the first letter capital as: $this->load->model('Customer_model') this modules_find function at line:130 in modular_helper.php doesn't include lower case string so that this fails and the follwing error Code: An Error Was Encountered Is there a way to use class name with capital as suggested in CI user guide? Thanks
[eluser]wiredesignz[/eluser]
Model class names must be Capitalised, but file names must be lowercase as suggested in the CI user guide.
[eluser]moksahero[/eluser]
In the user guide: http://ellislab.com/codeigniter/user-gui...odels.html under "Loading a Model" section model names with first letter being capital is used. for $this->Model_name->function(). This has been the way I have loaded and called all model related functions and I expected Modular Extensions to behave the same. Am I missing something??
[eluser]Jilani Jidni[/eluser]
[quote author="moksahero" date="1218719971"]In the user guide: http://ellislab.com/codeigniter/user-gui...odels.html under "Loading a Model" section model names with first letter being capital is used. for $this->Model_name->function(). This has been the way I have loaded and called all model related functions and I expected Modular Extensions to behave the same. Am I missing something??[/quote] You are in right track. please check what is your file name. if your model class name Customer_model then file name should be customer_model.php. or check it into the manual If you would like your model assigned to a different object name you can specify it via the second parameter of the loading function: Code: $this->load->model('Model_name', 'fubar'); hope this will help you.
[eluser]moksahero[/eluser]
The problem is that when I use : $this->load->model('Customer_model'); ME looks for Customer_model.php not customer_model.php in the directory. I saw the piece of code in ME that was not using lower case for file names and I started fixing it but I thought better to involve community with it. Thanks
[eluser]wiredesignz[/eluser]
ME checks for both lowercase filenames (customer_model.php) and capitalised filenames (Customer_model.php) in modules_find() method. However you must use lowercase object names when loading and accessing them. Code: $this->load->model('customer_model'); |
Welcome Guest, Not a member yet? Register Sign In |