Form Validation Callbacks in HMVC in Codeigniter

Many of us are using the HMVC extension (Hierarchical Model View Controller) in codeigniter which is available.

HMVC helps developing modular apps in a very convenient way. All the things work simply fine just like a clean CI installation. There’re 1 or two exceptions which i have found. One is the callback of Form_validation class. If we are making some forms like registration we check emails and usernames and we do it in the form validation class using callbacks. If we look at the basic callback structure when validating forms from CI documentation, it appears like.


But this callback will not simply work. Some of my precious hours went why it was not working. Then i navigated the Form_validation.php in /system/libraries folder around line 580 which looks like


The function – method_exists returns false even if the callback function is there in the Controller and after all in the CI loader object. So it came out from the forum that you have to do a little extension to Form Validation class which is


And when running the validation like in earlier code

you have to provide an addition $this as a parameter to run method. which will look like

Now, your validation callbacks will work perfectly.

Another note, if you’re trying to access a public variable of a controller via the get_instance() in hooks , you’ll have to write in your controller like this.

CI::instance()->var_name = “Some Value”;

May be there are some other required adjustments when using HMVC, but i came across this two time killing adjustments.

Is Kohana moving faster than Codeigniter ?

Traffic Codeigniter VS KohanaPHP

Look at the Alexa graph above. What do u think ?  

I’ve been using Codeigniter in Mid and Fairly Big project for over a year and a half. Kohana was released before i started but the amount of online support and tutorials and an active company development (EllisLab) made me decide using CodeIgniter. But I keep checking updates on Kohana because it has lot of extra features over CI. It’s Strictly PHP5 OOP and has libraries like ORM which doesn’t exist CI’s distribution. Just out of curiosity, i went to Alexa and compared the traffic for CI and KohanaPHP and it really surprised me. Kohana is way ahead in terms of traffic. What does that mean? People are more involved with Kohana than CI ? Well, apparently YES. Kohana is community driven development. In CI, user contributes as addons to the Framework, which is ok. But when there’s an active driving force by the community, it’s better, at least i think. 

Moreover I read some articles how to easily use Zend in Kohana in the So that makes me think of leaning towards Kohana for my next projects. There are of course ways to use CI with Zend though but the integration method of Kohana with Zend looked neat. It won’t get much tough to switch to Kohana because it was originally based on CI. And default design pattern in Kohana is Factory (as it appears) while CI is singleton. Of course I’ll need to analyze some more benchmarks for scalability and other features before shifting focus. 

Partners Section:

depfile password Depfile Premium Account Depfile Premium Depfile Premium Account Depfile Premium Depfile Premium Account Depfile Premium Account dep file Dep file dep file dep file dep file dep file Depfile Premium Account Depfile Premium yify torrent empire torrent yify vikings season 4 auto clicker autoclicker slender the eight pages he gift torrent walking dead torrent the walking dead torrent fl studio 12 torrent