![]() |
Smarty with 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: Smarty with CI4 (/showthread.php?tid=89102) |
Smarty with CI4 - n2fole00 - 01-08-2024 Hi, I'm trying to get Smarty (v4) working with CI4. Googling around, I found this https://forum.codeigniter.com/showthread.php?tid=76323&pid=377901#pid377901 but it seems to be missing ThirdParty/Smarty/Autoloader.php as the error message reports. Reading the CI4 docs, I don't really understand how I would get the library working. Does someone have a working tutorial? Thanks. RE: Smarty with CI4 - n2fole00 - 02-11-2024 Ok, I got something working ![]() Well I decided to go with Twig, but I think the same idea will work for Smarty. Source info: https://twig.symfony.com/doc/3.x/intro.html#basic-api-usage First install twig with composer. Code: composer require "twig/twig:^3.0" In BaseController.php PHP Code: namespace App\Controllers; Then in your controller PHP Code: namespace App\Controllers; Here, I created twigRender as an alternative to PHP Code: echo $this->twig->render('test.twig', ['name' => 'Noel']); but it's not required. RE: Smarty with CI4 - kenjis - 02-11-2024 https://packagist.org/packages/sarah-systems/ci4smarty https://packagist.org/packages/maheswara/ci4smarty https://packagist.org/packages/zubdev/ci4smarty |