Welcome Guest, Not a member yet? Register   Sign In
Undefined property: MY_Config::$item
#1

[eluser]CARP[/eluser]
Hi
I'm getting this strange error while working on my application

1- I've created a new config file which contains only this
Code:
<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
    $config['dir_views'] = '/compras/system/application/views';
?>

2- I've put this file in application/config and put in autoload

3- I echo the value inside a view (for testing) and works
Code:
echo $this->config->item('dir_views');

4- The problem:
I have a main_view.php
I load a second_view.php from within main_view

And... If I do again the echo of dir_views config item inside second_view
Code:
<h1>Second_view</h1>
&lt;?
    $CI =& get_instance();
    $CI->config->load('variables');
    $dir_views = $CI->config->item['dir_views'];
?&gt;

I get this
Click to see image
#2

[eluser]stuffradio[/eluser]
Why are you getting an instance of CI inside a view? It already has it.

Just go
Code:
echo $this->config->item('dir_views');
inside your second view.
#3

[eluser]CARP[/eluser]
damn.
I don't remember if I tried that before or not, but now it is working




Theme © iAndrew 2016 - Forum software by © MyBB