Extend Form_Validation |
I use Codeigniter 3.0.6
I want extend the library Form_Validation but not received a personal message error MY_validation extends CI_Form_validation PHP Code: <?php if (!defined('BASEPATH')) exit('No direct script access allowed'); My controller PHP Code: class valid extends MY_Controller{ In the View print an errors echo validation_errors(); see {url} and not personal message. Help me
You should use visibility attribute in parent class.
Since version 5.3.3 (which is some 6 years now), method with same name as class are replaced with __construct(). Class names in CI3 should be ucfirst treated. You should make it in way docs propose `MY_Form_validation extends CI_Form_validation{}`. Prefix `MY_` shouldn't be used when file is called/class is loaded. `$this->My_validation->set_message` can be `$this->form_validation->set_message`.
It should also be named MY_Form_validation not MY_validation.
What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
I changed the library as suggested and etc.
PHP Code: <?php if (!defined('BASEPATH')) exit('No direct script access allowed'); The library still do not work. Help me, I can not continue create the application
You don't need to create separate variable for CI instance if you are extending CI system class.
Socondly, when loading your newly created class, you don't need prefix 'MY_'. PHP Code: <?php if (!defined('BASEPATH')) exit('No direct script access allowed'); Controller example code: PHP Code: <?php if (!defined('BASEPATH')) exit('No direct script access allowed');
I try but not work.
I am using Codeigniter 3.0.6 (last version) (04-04-2016, 03:32 PM)Tpojka Wrote: I believe that the controller does not read extensive library, but only the message from the language file
What I showed you is basic example from docs.
You should test most simplified example like one in docs and see what (and if) went wrong. I already linked that page/section before. PHP Code: $this->CI =& get_instance(); What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
(04-05-2016, 05:52 AM)InsiteFX Wrote: I try : PHP Code: <?php if (!defined('BASEPATH')) exit('No direct script access allowed'); Now to continue the application I using callback function. PHP Code: <?php if (!defined('BASEPATH')) exit('No direct script access allowed'); What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
|
Welcome Guest, Not a member yet? Register Sign In |