[eluser]Daeli[/eluser]
Hey there,
got a huge problem
Look at this. Iam loading a module over my uri:
Code:
$module = $this->uri->segment(1, "welcome");
$method = $this->uri->segment(2, "index");
$args = array_slice($this->uri->segment_array(), 2);
$this->load->module($module);
...some lines later i load the content into my template container:
Code:
$content['main'] = $this->$module->$method($args);
Now when i try to load validation library inside my module controller i get an error:
Fatal error: Call to a member function set_rules() on a non-object in C:\workspace\capitalo\system\application\modules\user\controllers\user.php on line 18
Module controller is stored under:
Application
-Modules
--User
---Controllers
----user.php
Here is the Module Controller code:
Code:
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
Class User extends Controller{
function __construct()
{
parent::Controller();
}
function login(){
$this->assetlib->load('mootools', 'js');
$this->assetlib->load('common', 'js');
$this->lang->load('user');
$this->load->library('validation');
$rules['user_name'] = "required";
$rules['user_pass'] = "required";
$this->validation->set_rules($rules);
if($this->validation->run() == FALSE)
return $this->load->view('login', null, TRUE);
}
function register(){
}
}
?>