Welcome Guest, Not a member yet? Register   Sign In
Configuration file not loaded
#1

I am trying to setup this CodeIgniter Multilevel Menu library but I can't get it to work. Take a look to my `autoload.php` file:

PHP Code:
$autoload['libraries'] = ['database''ion_auth''form_validation''Multi_Menu'];
$autoload['helper'] = ['url''language'];
$autoload['config'] = ['multi_menu']; 

If I am not wrong both the library and the config should be autoloaded but they are not and I don't know why. Every time I try to load the page I got this error:

Quote:A PHP Error was encountered
Severity: 4096
Message: Argument 1 passed to Multi_Menu::render() must be of the type array, none given, called in /var/www/html/plataforma56.local/application/controllers/Welcome.php on line 15 and defined
Filename: libraries/Multi_Menu.php
Line Number: 286
Backtrace:
File: /var/www/html/plataforma56.local/application/libraries/Multi_Menu.php
Line: 286
Function: _error_handler
File: /var/www/html/plataforma56.local/application/controllers/Welcome.php
Line: 15
Function: render
File: /var/www/html/plataforma56.local/index.php
Line: 288
Function: require_once

What I am missing here? How do I know if a config file has been loaded?

Thanks in advance
Reply
#2

You need to give the render method a default value then you will not get the error.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#3

try:<?php echo $this->multi_menu->render('Item-0'); ?>or <?php echo $this->multi_menu->render(array()); ?> since line 298 of Multi_menu.php states as follow : public function render($config = array(), $divided_items_list = array(), $divider = ''). so parameter 1 must be an array or any kin of value. by the way, what did you put inside $this->multi_menu->render() ?
Be Simple Angel
Reply
#4

(08-06-2016, 05:21 PM)waptik Wrote: try:<?php echo $this->multi_menu->render('Item-0'); ?>or <?php echo $this->multi_menu->render(array()); ?> since line 298 of Multi_menu.php states as follow : public function render($config = array(), $divided_items_list = array(), $divider = ''). so parameter 1 must be an array or any kin of value. by the way, what did you put inside $this->multi_menu->render() ?

I am not sure to be following you but docs said:

Quote:Load the library manually or load automatically definied in application/config/autoload.php and it's ready to use. See example below

<?php
// execute query and get array data
$this->load->model("menu_model", "menu");
$items = $this->menu->all();

// load the library and pass the array data
$this->load->library("multi_menu");
$this->multi_menu->set_items($items);

// call render in view
echo $this->multi_menu->render();
?>

That's why I am calling render() without values
Reply




Theme © iAndrew 2016 - Forum software by © MyBB