HTML Table Class new error! - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28) +--- Forum: CodeIgniter 4 Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=31) +--- Thread: HTML Table Class new error! (/showthread.php?tid=74057) |
HTML Table Class new error! - videoproc - 07-16-2019 Hello! Please help! Added lines to controller method: PHP Code: $table = new \CodeIgniter\View\Table(); error: Class 'CodeIgniter\View\Table' not found What use to add? RE: HTML Table Class new error! - mboufos - 07-16-2019 check here https://www.codeigniter.com/user_guide/libraries/table.html load the library in controller : $this->load->library('table'); and the rest on view or what ever you like $data = array( array('Name', 'Color', 'Size'), array('Fred', 'Blue', 'Small'), array('Mary', 'Red', 'Large'), array('John', 'Green', 'Medium') ); echo $this->table->generate($data); i just tested it with no errors P.S. i dont know why you want this one $table = new \CodeIgniter\View\Table(); RE: HTML Table Class new error! - videoproc - 07-16-2019 This is good in CI3! I try it in CI4 and there such code does not work! Help me please! RE: HTML Table Class new error! - ciadmin - 07-16-2019 @mboutos This *is* the CodeIgniter 4 support subforum, hence the namespaced HTML Table usage ... https://codeigniter4.github.io/CodeIgniter4/outgoing/table.html @videoproc Your usage looks right out of the user guide, and should work. Need a bit more info for context ... where in your controller is this happening? is it perhaps outside of any method? RE: HTML Table Class new error! - InsiteFX - 07-16-2019 I just tried it in the Home Controller index method and it worked fine on my system. Something else must be wrong on your end. I' m using the latest developers version of CI 4. Output: Code: Name Color Size RE: HTML Table Class new error! - InsiteFX - 07-16-2019 Make sure you are running php 7.2+ it is required. RE: HTML Table Class new error! - videoproc - 07-16-2019 Use php 7.3 My code: PHP Code: <?php namespace App\Controllers; Errors log: Code: <?php defined('SYSTEMPATH') || exit('No direct script access allowed'); ?> RE: HTML Table Class new error! - videoproc - 07-17-2019 Updated CI to the latest version! It was beta 4.2. It all worked! I apologize for your concern! RE: HTML Table Class new error! - InsiteFX - 07-17-2019 No problem, that's what we are here for. |