CodeIgniter Forums
Modular Extensions - HMVC version 5.3 - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=22)
+--- Thread: Modular Extensions - HMVC version 5.3 (/showthread.php?tid=33523)

Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39


Modular Extensions - HMVC version 5.3 - El Forum - 09-24-2010

[eluser]icomefromthenet[/eluser]
I was having a problem with blank screen after a install of the new HMVC code (1.7.2), In my case I tracked it down to the /third_party/MX/Config.php file, the config file under System/libraries/config.php was already included (so new file not loaded), so after a rename of the file (not class inside) my problem went away.


Modular Extensions - HMVC version 5.3 - El Forum - 09-24-2010

[eluser]wiredesignz[/eluser]
[quote author="icomefromthenet" date="1285331018"]I was having a problem with blank screen after a install of the new HMVC code (1.7.2), In my case I tracked it down to the /third_party/MX/Config.php file, the config file under System/libraries/config.php was already included (so new file not loaded), so after a rename of the file (not class inside) my problem went away.[/quote]

And you have broken the installation. Good luck with that.
File names are not the issue.


Modular Extensions - HMVC version 5.3 - El Forum - 09-24-2010

[eluser]wiredesignz[/eluser]
Modular Extensions - HMVC bitbucket wiki is updated.


Modular Extensions - HMVC version 5.3 - El Forum - 09-24-2010

[eluser]coffey[/eluser]
As you say @InsiteFX
Quote:
Code:
// WRONG!
class Welcome_m extends Model {

// CORRECT!
class Welcome_m extends CI_Model {

Thanks. It suited me to create a model extending CI_Model (autoloaded via config/autoload).
Code:
<?php if (! defined('BASEPATH')) exit('No direct script access');

// File to contain CRUD functions

class Model extends CI_Model {

    function __construct() {
        parent::__construct();
    }

}
//end of file: Model.php
//location: /application/models/Model.php

Really not much of a change here anyway as most of my previous 1.7 module models were in themselves descended from an extended 'crud' base model anyway.


Modular Extensions - HMVC version 5.3 - El Forum - 09-24-2010

[eluser]coffey[/eluser]
BTW big thanks to @wiredesignz for all his fantastic work. Now where is that donate button.....


Modular Extensions - HMVC version 5.3 - El Forum - 09-24-2010

[eluser]wiredesignz[/eluser]
Thanks coffey, much appreciated.


Modular Extensions - HMVC version 5.3 - El Forum - 09-27-2010

[eluser]Phil Sturgeon[/eluser]
It looks to me like callback functions don't work when I extend from MX_Controller. My login callback was the one that made me spot this:

Code:
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
/**
* @package     MizuCMS
* @subpackage     Controllers
*/
class Dashboard extends CMS_Controller
{
     // Admin: Control Panel
     function index()
    {
        $this->template->build('cms/dashboard');
    }
    
    // Admin: Log in
    function login()
    {
        // Call validation and set rules
        $this->load->library('form_validation');

        // Set the validation rules
        $this->form_validation->set_rules(array(
            array(
                'field' => 'email',
                'label' => lang('user_email_label'),
                'rules' => 'required|trim|callback__check_login'
            ),
            array(
                'field' => 'password',
                'label' => lang('user_password_label'),
                'rules' => 'required|min_length[6]|max_length[20]'
            ),
        ));

        // If the validation worked, or the user is already logged in
        if ($this->form_validation->run() or $this->ion_auth->logged_in())
        {
            redirect('cms');
        }
        
        else
        {
            $data->messages['error'] = validation_errors();
        }
        
        $this->template->set_layout(FALSE);
        $this->template->build('cms/login', $data);
    }
    
    function logout()
    {
        $this->ion_auth->logout();
        redirect('cms/login');
    }    
    
    // Callback From: login()
    function _check_login($email)
    {
        if ( ! $this->ion_auth->login($email, $this->input->post('password')))
        {
            $this->form_validation->set_message('_check_login', $this->ion_auth->errors());
            return FALSE;
        }

        return TRUE;
    }
}

_check_login() is never called at all. I threw a exit('hai!') in the first line of the method and got nothing, I'd have a go debugging the error but I've already spent almost an hour of work time getting this far. >.<


Modular Extensions - HMVC version 5.3 - El Forum - 09-27-2010

[eluser]WanWizard[/eluser]
Ran into this issue as well.

The form validation library expects callbacks to be methods of $this->CI (set in the library constructor, when you load the form validation library), which probably points to something else than your module controller...


Modular Extensions - HMVC version 5.3 - El Forum - 09-27-2010

[eluser]wiredesignz[/eluser]
I have explained this so many times.
Set the Form_validation $CI instance to the object you require to respond to callbacks.

Code:
// Call validation and set rules
$this->load->library('form_validation');

//Set the callback object
$this->form_validation->CI = $this;



Modular Extensions - HMVC version 5.3 - El Forum - 09-27-2010

[eluser]Phil Sturgeon[/eluser]
This doesn't seem like an amazingly clean solution... Is there no way to build support for this into ME?