extending core class input (v2.0.1) - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: extending core class input (v2.0.1) (/showthread.php?tid=41634) |
extending core class input (v2.0.1) - El Forum - 05-12-2011 [eluser]fajnalowiec[/eluser] Is it possible to create my own extended core class input and use it simultaneously with the basic input class? I am lazy and forgetful, so I created MY_Input inherited from CI_Input for automatic trim and htmlspecialchars_decode all $_POST data. But there are a little data like form->input->password or data from CKEditor (which is already html_entity_decoded) which I would like to read by basic CI input. The point is; it would would be nice to name my inherited class for example "MY_Input2", then load it as library "input2" and then in controller use it "$this->input2->post(...)" or use the native CI_Input like this "$this->input->post(...)" whenever I want one or the second. extending core class input (v2.0.1) - El Forum - 05-12-2011 [eluser]cideveloper[/eluser] MY_Input is just Extending the Native Input Library. Why dont you just do it like this Code: $this->input->post_ext(...) as in make a new post function called post_ext [post extended] in MY_Input That way you can use Code: $this->input->post_ext(...) or Code: $this->input->post(...) extending core class input (v2.0.1) - El Forum - 05-13-2011 [eluser]fajnalowiec[/eluser] thanks a lot. I have focused too much on my idea. I used post with predefined params: function post($index = NULL, $xss_clean = FALSE, $enable_htmlspecialschars_decode = TRUE, $enable_trim = TRUE) but Your solution is quite better. |