Welcome Guest, Not a member yet? Register   Sign In
Codeigniter + Doctrine = Message: Undefined property: CI_Loader::$table
#1

[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
#2

[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');
#3

[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.
#4

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

[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?
#6

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

[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.




Theme © iAndrew 2016 - Forum software by © MyBB