CodeIgniter Forums
Cannot load views after updating HMVC? - 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: Cannot load views after updating HMVC? (/showthread.php?tid=51038)



Cannot load views after updating HMVC? - El Forum - 04-18-2012

[eluser]Sven Delle[/eluser]
I've been trying to fix the callback problem with form_validation without any luck.

And in the process I downloaded the latest version of HMVC.

And now I can't load views anymore, I only get:

An Error Was Encountered
Unable to load the requested file: login_form.php

Now, what the f... is going on?

When reverting back to the previous version, everything is ok - apart from the callback form_validation problem which persists.

Anyone got any ideas?


Cannot load views after updating HMVC? - El Forum - 04-18-2012

[eluser]InsiteFX[/eluser]
You will get a better answer if you post this in the HMVC forum topic.

What version of CI are you running and what version of CI before that works?



Cannot load views after updating HMVC? - El Forum - 04-18-2012

[eluser]Sven Delle[/eluser]
Weird thing is they both state to be 5.4. But I can see a difference in the classes.

Line 51 in the old /third_party/MX/Controller.php says:
Code:
$this->load->_init($this);


And the "new" (as in latest download) says:
Code:
$this->load->initialize($this);

And in the /third_party/MX/Loader.php:

There's no __construct function but an initialize function instead, and a check for MX_Controller:
Code:
if (is_a($controller, 'MX_Controller')) {
  
   /* reference to the module controller */
   $this->controller = $controller;
  
   /* references to ci loader variables */
   foreach (get_class_vars('CI_Loader') as $var => $val) {
    if ($var != '_ci_ob_level') {
     $this->$var =& CI::$APP->load->$var;
    }
   }
  } else {
   parent::initialize();
  }

But no matter what: it doesn't fix the form_validation callback problem, and screws up my whole app: no views load anymore!?

And by the way I never extend MX_Controller or MX_Loader anywhere in my app, but I see references to it all over the place. My modules works just fine extending CI_Controller. If I try extending MX_Controller I get all sorts of errors, so that not a direction to take.


Cannot load views after updating HMVC? - El Forum - 04-25-2012

[eluser]Stoney[/eluser]
I had the same validation callback problem.

There is a bug at HMVC with callback functions.
You have to make a workaround yourself.


Cannot load views after updating HMVC? - El Forum - 04-25-2012

[eluser]wiredesignz[/eluser]
The form_validation callback issue is not a bug. The solution for this has been posted many times before in other topics here. Search the forums or ACTUALLY READ the Modular Extensions - HMVC wiki. Thanks.


Cannot load views after updating HMVC? - El Forum - 04-25-2012

[eluser]Sven Delle[/eluser]
I did read the HMVC - over and over again. But my mistake was, that I managed to screw up the parameters.

I did:
Code:
$this->form_validation->set_rules('username', 'Username', 'required', 'callback_check_default_username');

Instead of:
Code:
$this->form_validation->set_rules('username', 'Username', 'required|callback_check_default_username');

I was sending four parameters to set_rules instead of piping the last couple together, making it three.

So my error had absolutely nothing to do with HMVC or call_back malfunctioning - I was simply an overtired code monkey staring at a blurred screen in the middle of the night.


Cannot load views after updating HMVC? - El Forum - 04-25-2012

[eluser]Stoney[/eluser]
I wasn't aware of that solution. Thx.