error on the first page |
Hello,
Can anyone help me troubleshoot where the problem in my codes? http://127.0.0.1/CompanyGiondaCI/ -------------------------------------- A PHP Error was encountered Severity: Notice Message: Undefined property: Mpages::$load Filename: libraries/Form_validation.php Line Number: 147 Backtrace: File: C:\Program Files (x86)\EasyPHP-Devserver-16.1\eds-www\CompanyGiondaCI\application\models\mpages.php Line: 10 Function: __construct File: C:\Program Files (x86)\EasyPHP-Devserver-16.1\eds-www\CompanyGiondaCI\application\controllers\cpages.php Line: 32 Function: model File: C:\Program Files (x86)\EasyPHP-Devserver-16.1\eds-www\CompanyGiondaCI\index.php Line: 315 Function: require_once Fatal error: Call to a member function helper() on null in C:\Program Files (x86)\EasyPHP-Devserver-16.1\eds-www\CompanyGiondaCI\system\libraries\Form_validation.php on line 147 A PHP Error was encountered Severity: Error Message: Call to a member function helper() on null Filename: libraries/Form_validation.php Line Number: 147 Backtrace:
" If I looks more intelligence please increase my reputation."
(07-05-2016, 02:06 AM)davy_yg Wrote: Hello, Make sure your class and file names have only the first letter upper case. Make sure that cpages.php is like Cpages.php and same for class. And don't leave your base url blank if your using CI3 PHP Code: $config['base_url'] = ''; To Code: $config['base_url'] = 'http://localhost/your_project/';
There's only one rule - please don't tell anyone to go and read the manual. Sometimes the manual just SUCKS!
I still do not understand why after fixing all these the same error still appears ?
models/mpages.php PHP Code: <?php controllers/cpages.php PHP Code: <?php config/config.php PHP Code: $config['base_url'] = 'http://localhost/CompanyGiondaCI/';
" If I looks more intelligence please increase my reputation."
For starters, Mpages should extend CI_Model, not CI_Controller, and the file names of your controllers and models need to have the first letter in upper case, matching the class names.
If your controller (Cpages) extends the constructor, it needs to call the parent constructor (as your model currently does).
Hello,
I already fix couple things mentioned and still having that same problem remains. A PHP Error was encountered Severity: Notice Message: Undefined property: Mpages::$load Filename: libraries/Form_validation.php Line Number: 147 Backtrace: File: C:\Program Files (x86)\EasyPHP-Devserver-16.1\eds-www\CompanyGiondaCI\application\models\mpages.php Line: 10 Function: __construct File: C:\Program Files (x86)\EasyPHP-Devserver-16.1\eds-www\CompanyGiondaCI\application\controllers\cpages.php Line: 32 Function: model File: C:\Program Files (x86)\EasyPHP-Devserver-16.1\eds-www\CompanyGiondaCI\index.php Line: 315 Function: require_once Fatal error: Call to a member function helper() on null in C:\Program Files (x86)\EasyPHP-Devserver-16.1\eds-www\CompanyGiondaCI\system\libraries\Form_validation.php on line 147 A PHP Error was encountered Severity: Error Message: Call to a member function helper() on null Filename: libraries/Form_validation.php Line Number: 147 Backtrace: controllers/cpages.php PHP Code: <?php models/mpages.php PHP Code: <?php
" If I looks more intelligence please increase my reputation."
Your filenames in the error message still aren't correct (they should be Mpages.php and Cpages.php, rather than mpages.php and cpages.php).
A quick search on this error message indicates that it usually shows up when using HMVC or some test frameworks, though it might also show up when calling a controller from a controller without either of those in place (because you shouldn't call a controller from a controller). In any case, you're not including enough code to track down the problem (you haven't even included the code that loads the form validation library), and your error messages still show other problems (which may not be related to this specific problem, but will probably cause other problems once you do get everything else working). |
Welcome Guest, Not a member yet? Register Sign In |