Welcome Guest, Not a member yet? Register   Sign In
How to use $request->uri->getSegment() inside view?
#6

This would work, but if you follow the MVC pattern, the view is only supposed to display data. It's not supposed to fetch all kind of data from the request or the database. If you need something in the view, the best practice is to get it in the controller and pass it to the view. This way, the view contains almost exclusively html code with the exception of the echoes for the data.
CodeIgniter 4 tutorials (EN/FR) - https://includebeer.com
/*** NO support in private message - Use the forum! ***/
Reply


Messages In This Thread
RE: How to use $request->uri->getSegment() inside view? - by includebeer - 06-29-2021, 05:24 PM



Theme © iAndrew 2016 - Forum software by © MyBB