![]() |
Call function from controller in view - 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: Call function from controller in view (/showthread.php?tid=80593) |
Call function from controller in view - cvlancvlan - 11-19-2021 How can i call products() function from CategoryController in app/views/category.php app/views/category.php <?php $this->products() ?> app/controllers/CategoryController.php PHP Code: <?php namespace App\Controllers; RE: Call function from controller in view - InsiteFX - 11-19-2021 You should not be calling a method from a controller in you views, that would be breaking the MVC rule. If you need something like that then create a library or helper with the method in it. To execute a method in the controller use an CodeIgniter achor or html link. |