⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

what is the effect of hmvc on grocerycrud?



edramirez
  • profile picture
  • Member

Posted 03 November 2013 - 15:58 PM

For purposes of discussion, I'd like to ask this: what is the effect of hmvc on grocerycrud? Let me clarify.

 

There are videos on youtube that explain how to download and incorporate the hmvc library into codeigniter. And then we may later add grocerycrud to codeigniter/hmvc.

 

Even before we add grocerycrud, there is a documented problem that callbacks don't work in the codeigniter/hmvc setup. David Connely offered a solution. I don't know if there is still a need to use the solution when codeigniter is blended with both hmvc and grocerycrud. Anyway, this is just one situation.

 

Grocerycrud isn't just another php library that is incorporated to the mix. It also includes jquery and bootstrap, together with a bunch of javascript and css files. I'm not sure if having CI with HMVC makes a better blending of all these codes or if some adjustments have to be made for them to work properly together.

 

So, my specific questions are:

- Are there grocerycrud functions that would not work properly with hmvc installed?

- What are some things we should remember to do or not do when we use codeigniter/hmvc/grocercrud?

- Does grocerycrud work better and faster with hmvc libraries installed in codeigniter?

 

Thanks in advance!!!


goFrendiAsgard
  • profile picture
  • Member

Posted 03 November 2013 - 23:11 PM

- Are there grocerycrud functions that would not work properly with hmvc installed?

Yes, there are. As you mention, callback on set_rules() function. This is related to CodeIgniter form_validation class. You can apply this: http://www.mahbubblog.com/php/form-validation-callbacks-in-hmvc-in-codeigniter/ or /topic/426-form-validation-callbacks-not-working-with-hmvc-modular-extention/#entry3020. However you will need to rewrite some of your existing code.

Or you might also want to try this solution (I apply it to No-CMS and it is work):

  1. Add this file: https://github.com/goFrendiAsgard/No-CMS/blob/8b6484c1a6651c197409e68c9386348d242950ee/application/libraries/MY_Form_validation.php and this file: https://github.com/goFrendiAsgard/No-CMS/blob/8b6484c1a6651c197409e68c9386348d242950ee/application/libraries/Extended_Grocery_CRUD.php

     

  2. Make a MY_Controller.php in /application/core, and put this:
class MY_Controller extends MX_Controller{
    public function __construct__(){
        $this->load->library('form_validation');
        $this->form_validation->CI =& $this;
        $this->load->library('Extended_Grocery_CRUD');
        // resolve HMVC set rule callback problem
        $crud->form_validation = $this->form_validation;
    }
}
Now, you can just relax. and do this in your function: $crud = $this->crud;

 

- What are some things we should remember to do or not do when we use codeigniter/hmvc/grocercrud?
Just as my answer for your first question.
 

- Does grocerycrud work better and faster with hmvc libraries installed in codeigniter?
No, it is a bit slower since HMVC not only check "application" directory, but also everything in "modules" directory. But not that slow...


buoncri
  • profile picture
  • Member

Posted 02 September 2015 - 20:55 PM

Really intresting ... i have to try :-D


buoncri
  • profile picture
  • Member

Posted 02 September 2015 - 20:56 PM

Really intresting ... i have to try :-D


buoncri
  • profile picture
  • Member

Posted 02 September 2015 - 20:56 PM

 .