Welcome Guest, Not a member yet? Register   Sign In
HTML Table class bug in CI 2.1.0
#1

[eluser]Unknown[/eluser]
Just a simple code from CI user guide is not working. I have checked from CI_Table class in System folder and it exists.

file
/home/application/controllers/cron_projectx.php

code:

Code:
class cron_projectx extends CI_Controller {

public function admin_reports( $arg = 1)
{
  $this->load->library('table');
  $this->table->set_heading('Name', 'Color', 'Size');
  $this->table->add_row('Fred', 'Blue', 'Small');
  $this->table->add_row('Mary', 'Red', 'Large');
  $this->table->add_row('John', 'Green', 'Medium');

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

call via browser:
http://example.com/index.php/cron_projec...in_reports

Output
-----------------------------------------
A PHP Error was encountered

Severity: Notice

Message: Undefined property: cron_projectx::$table

Filename: controllers/cron_projectx.php

Line Number: 9
-----------------------------------------
#2

[eluser]InsiteFX[/eluser]
And where are you calling this from you need to show more code

#3

[eluser]vrencianz[/eluser]
Your example is correct and works from my side for a fresh codeigniter installation. Do you have another table library inside your application/libraries folder?

#4

[eluser]Unknown[/eluser]
It is working in my local setup. Only on the Linux hosting server, it gives the error.
#5

[eluser]vrencianz[/eluser]
Then make sure that Table.php is readable by your web browser. You can try chmod a+r Table.php, but you need (if the read permission is the problem) chmod -R a+r 'your codeigniter dir'.

Hope this helps.
#6

[eluser]InsiteFX[/eluser]
You need to save all files when uploading them to a Linux server in lowercase!




Theme © iAndrew 2016 - Forum software by © MyBB