![]() |
Custom view method - 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: Custom view method (/showthread.php?tid=76370) |
Custom view method - imabot - 05-06-2020 In CI3, I created a custom view method (cView) by extending CI_Loader : Quote:// My controller, log user data and search queries Since CI_Loader and the core folder no longer exist, I can't figure out where I should create my custom cView function in CI4? The main constrain is that cView() calls the native view() method. RE: Custom view method - jreklund - 05-06-2020 Here are the complete code for view. You can create your own cView and put in in app/Common.php based on that. Or overwrite the system function. https://codeigniter.com/user_guide/outgoing/view_renderer.html PHP Code: if (! function_exists('view')) RE: Custom view method - imabot - 05-07-2020 (05-06-2020, 11:33 AM)jreklund Wrote: Here are the complete code for view. You can create your own cView and put in in app/Common.php based on that. Or overwrite the system function. Thank for the answer, if I want to overwrite the system function, where should I put the code ? RE: Custom view method - jreklund - 05-08-2020 In app/Common.php, as it's loaded first. RE: Custom view method - imabot - 05-09-2020 Thank you to all of you for these answers. I finally place my custom view in the BaseController since I use it everywhere in my apps: https://forum.codeigniter.com/thread-75176.html |