![]() |
fail to use jpgraph in CI4 - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28) +--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30) +--- Thread: fail to use jpgraph in CI4 (/showthread.php?tid=88314) |
fail to use jpgraph in CI4 - foxbille - 08-21-2023 Hello, I need to use php jpgraph library, so i have put it in a folder (because of the large number of files) Jpgraph located in app\Libraries so path to jpgraph class file is : app\Libraries\Jpgraph\jpgraph.php in a controller : PHP Code: use App\Libraries\Jpgraph\jpgraph; I got : Error, Class "App\Controllers\Graph" not found if I change Graph to jpgraph PHP Code: $this->jpgraph = new jpgraph(); i got : ErrorException, Uncaught Error: Class "App\Libraries\Jpgraph\jpgraph" not found in [...]/app/Controllers I migh have done something wrong, but what? RE: fail to use jpgraph in CI4 - ozornick - 08-21-2023 In file app\Libraries\Jpgraph\jpgraph.php set namespace App\Libraries\Jpgraph\jpgraph? If not set probaly new \jpgraph() RE: fail to use jpgraph in CI4 - kenjis - 08-21-2023 It seems JpGraph is not autoloadable. https://jpgraph.net/download/manuals/chunkhtml/ch01s04.html#example.example0 I recommend you require (adjust the file path): PHP Code: require_once ('jpgraph/jpgraph.php'); and write like: PHP Code: $this->jpgraph = new \Graph(); RE: fail to use jpgraph in CI4 - foxbille - 08-23-2023 Ok, Thanks to you both, will try it. Meanwhile have found this : https://packagist.org/packages/amenadiel/jpgraph But for now, have to fix problems with twig use. Have a nice day, Eric RE: fail to use jpgraph in CI4 - foxbille - 08-23-2023 Fatal error: Uncaught Error: Class "App\Libraries\Jpgraph\jpgraph\Text" not found in /home/[...]/traces/app/Libraries/Jpgraph/jpgraph.php Sorry, I give up. RE: fail to use jpgraph in CI4 - kenjis - 08-23-2023 JpGraph is not namespaced. So there is no "App\Libraries\Jpgraph\jpgraph\Text" class. RE: fail to use jpgraph in CI4 - foxbille - 08-24-2023 (08-23-2023, 02:36 PM)kenjis Wrote: JpGraph is not namespaced. So there is no "App\Libraries\Jpgraph\jpgraph\Text" class. Ok, thanks anyway |