![]() |
controler function question - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21) +--- Thread: controler function question (/showthread.php?tid=12720) |
controler function question - El Forum - 10-29-2008 [eluser]quasiperfect[/eluser] hi in a controller we can have the validation function callbacks. if we call the controller site/controller/function we get the php errors how can i avoid this ? (i don't need/want to call the functions but if someone dose) controler function question - El Forum - 10-29-2008 [eluser]drewbee[/eluser] Yes. controler function question - El Forum - 10-29-2008 [eluser]quasiperfect[/eluser] yes what ? controler function question - El Forum - 10-29-2008 [eluser]drewbee[/eluser] I would love to help you, but I am not sure what you are asking. Do you mean you do not want to be able to access the callback functions via the url? Prefix your callback functions with a _ IE Code: function _myCallback($val) This will make it private and no longer accessible via the url. controler function question - El Forum - 10-29-2008 [eluser]quasiperfect[/eluser] that's what i want but if i use _ before the function name then the function doesn't get called example normal use but the problem with enyone can call the controller/field_check url Code: $this->form_validation->set_rules('field', 'Field name', 'callback_field_check'); like u said the function doesn't get called Code: $this->form_validation->set_rules('field', 'Field name', 'callback_field_check'); if i modify the code like this it works but we have to modify everything with a _ and for a big site that's not something i would love to do any other solution available ? Code: $this->form_validation->set_rules('field', 'Field name', 'callback__field_check'); controler function question - El Forum - 10-29-2008 [eluser]drewbee[/eluser] when your calling the callback, you need to use two underscores... Code: $this->form_validation->set_rules('field', 'Field name', 'callback__field_check'); As for other ideas, this is how code igniter has been since I have used it. It really isn't that hard of a change just pop open all your controllers and add an extra _ infront of all functions and a _ infront of the rule setting. controler function question - El Forum - 10-29-2008 [eluser]dmiden[/eluser] Using double underscore is the optimal and correct solution quasiperfect. I really don't see a problem with it? controler function question - El Forum - 10-30-2008 [eluser]quasiperfect[/eluser] ok thanks for u'r responses i will use the '_' untill i find a better solution |