I made a module 'mymenu' that has a controller 'mymenu'. 'mymenu' has a public method single_level()
single level return 'html' content.
I made a mymenu object and call single_level()
but it is showing error.
-----------------------------
A PHP Error was encountered
Severity: Notice
Message: Undefined property: Mymenu::$fuel_auth
Filename: libraries/Fuel_base_controller.php
Line Number: 31
Fatal error: Call to a member function user_data() on a non-object in
\xampp\htdocs\ufcm\fuel\modules\fuel\libraries\Fuel_base_controller.php on line 31
----------------------------------------
--------------mymenu.php------------------------
<?php
require_once(MODULES_PATH.'/fuel/libraries/fuel_base_controller.php');
class Mymenu extends fuel_base_controller{
function __construct() {
parent::__construct();
}
public function single_level(){
$fuel_auth=new Fuel_auth();
$user=$fuel_auth->valid_user();
$this->load->model('menu_model');
$menu['items']= $this->menu_model->getItems($user['id']);
return $this->load->view('single_level',$menu,TRUE);
}
}
--------------------ufcm.php-------------------------
<?php
require_once(MODULES_PATH.'/ufcm/libraries/ufcm_base_controller.php');
require_once(MODULES_PATH.'/mymenu/controllers/mymenu.php');
class ufcm extends Ufcm_base_controller {
function __construct()
{
parent::__construct();
$this->__check_permission();
}
function user(){
$template=new Template();
$mymenu=new Mymenu();
echo $mymenu->single_level();
$template->Template('user');
$template->render(FALSE);
}
}
Please solve this issue like previous problem.
Comments
$this->load->library('session');
go to http://localhost/ufcm/profile using browser and experience the problem
Download link: https://atishdipankaruniversity.sharefile.com/?cmd=rp&id=27fecad4882a45a3
username: aslampatwarybd@gmail.com
password: XXXX
Download the project ufcm.zip
PLease solve the issue
public function single_level(){ require_once(FUEL_PATH.'libraries/Fuel_auth.php'); $user=new Fuel_auth(); $user_id=$user->user_data('id'); $this->load->model('menu_model'); $menu['items']= $this->menu_model->getItems($user_id); echo $this->load->view('single_level',$menu,TRUE); }
use this link in your local server
and see the error
if (!class_exists('Fuel_base_controller')) { require_once(MODULES_PATH.'/fuel/libraries/fuel_base_controller.php'); }