CodeIgniter Forums

Full Version: Codeigniter + Doctrine = Message: Undefined property: CI_Loader::$table
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[eluser]Unknown[/eluser]
Hi i am pretty new to both Codeigniter and Doctrine,

ever since i added Doctrine i cannot get the Html Table class to work i haven't been able to find any information on the the problem anywhere.

Code:
$this->load->library('table');

$data = array(
             array('Name', 'Color', 'Size'),
             array('Fred', 'Blue', 'Small'),
             array('Mary', 'Red', 'Large'),
             array('John', 'Green', 'Medium')    
             );

echo $this->table->generate($data);

results in this error message

A PHP Error was encountered

Severity: Notice

Message: Undefined property: CI_Loader::$table

Filename: views/welcome_message.php

Line Number: 58


Fatal error: Call to a member function generate() on a non-object in C:\xampp\htdocs\CHIP\system\application\views\welcome_message.php on line 58

thanks for any help you can provide

El Forum

[eluser]canicasio[/eluser]
I think you have to load the table class.

Go to system/application/config/autoload.php

Set table at $autoload['libraries'] = array();

Like this: $autoload['libraries'] = array('table');

El Forum

[eluser]Zack Kitzmiller[/eluser]
Don't load libraries in the view. Load them in the controller. Then it will be available in the view. You don't need to autoload it if you don't want to.

El Forum

[eluser]canicasio[/eluser]
Im new in CI. Thanks for the clue.

El Forum

[eluser]asciiCode[/eluser]
If you load a library in the controller how do you access in the view?

For example you can't use $this->LibraryName->FunctionName() in the view. What would you use?

El Forum

[eluser]danmontgomery[/eluser]
Code:
$CI =& get_instance();
$CI->libraryname->function();

El Forum

[eluser]brookerrj[/eluser]
I had the same problem. The only way I could get it to work was by autoloading. Trying to use the library by loading it in the controller gave me the same problem that this thread's author experienced.