Tag: HMVC

CodeIgniter HMVC – Memperbaiki Error Message: Call to undefined method MY_Loader::_ci_object_to_array()

Untuk memperbaiki Error di atas maka :

  1. Buka application/third_party/MX/Loader.php
  2. Cari function  public function view($view, $vars = array(), $return = FALSE) Cari… (Line 300)

return $this->_ci_load(array(‘_ci_view’ => $view, ‘_ci_vars’ => $this->_ci_object_to_array($vars), ‘_ci_return’ => $return));

Ganti dengan :

if (method_exists($this, ‘_ci_object_to_array’))
{
return $this->_ci_load(array(‘_ci_view’ => $view, ‘_ci_vars’ => $this->_ci_object_to_array($vars), ‘_ci_return’ => $return));
} else {
return $this->_ci_load(array(‘_ci_view’ => $view, ‘_ci_vars’ => $this->_ci_prepare_view_vars($vars), ‘_ci_return’ => $return));
}

Selesai…

 

Referensi : http://stackoverflow.com/questions/41557760/codeigniter-hmvc-object-to-array-error

Iklan

Callback Form Validation Tidak jalan di HMVC CodeIgniter

Setelah mencari setengah hari akhirnya ketemu juga

Function Callback di Form Validation tidak jalan meski saya baca di user guide CI  :

http://ellislab.com/codeigniter/user-guide/libraries/form_validation.html#callbacks

Itu karena saya memakai HMVC

Akhirnya setelah browsing2 nemu, nemunya di sumber nya HMVC  :

1. pertama :

Buat file : MY_Form_validation.php di lokasi application/libraries/MY_Form_validation.php

<?php
/** application/libraries/MY_Form_validation **/
class MY_Form_validation extends CI_Form_validation
{
public $CI;
}

2. kemudian buat satu file sebagai extends MX_Controller

<?php
class Xyz extends MX_Controller
{
function __construct()
{
parent::__construct();

$this->load->library(‘form_validation’);
$this->form_validation->CI =& $this;
}
}

Akhirnya form saya berjalan seperti apa yang saya harapkan

It works

sumber :

https://bitbucket.org/wiredesignz/codeigniter-modular-extensions-hmvc