CodeIgniter Forums

Full Version: Instantiate model from helper
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

Is there a way I can instantiate my model from helper? I would like to it like this:

# user_helper.php
function user_form_session($session) {
$user = new User_model();
$user->email = $session['email'];
$user->password = $session['password'];
return $user;


El Forum

Solved. Load the model from controller who is using the helper.

El Forum

Or do it like this:

[code] $CI =& get_instance();