CodeIgniter Forums
Add change view folder for VIew - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28)
+--- Forum: CodeIgniter 4 Feature Requests (https://forum.codeigniter.com/forumdisplay.php?fid=29)
+--- Thread: Add change view folder for VIew (/showthread.php?tid=89062)

Pages: 1 2


RE: Add change view folder for VIew - ozornick - 02-12-2024

I wanted to change the theme for the user. The standard replacement in the controller method looks like a repeat. There is no other way to change the subject. To put it more simply, we need dynamic paths to templates
Code:
view($theme . '/user/dashboard');



RE: Add change view folder for VIew - kenjis - 02-12-2024

Sorry, I don't get what you say.
What is the standard replacement in the controller method?

Also, if view($theme . '/user/dashboard') works, it seems fine to me.
It is clear that you are using the theme's view file.
You don't need to change the path in the View instance.


RE: Add change view folder for VIew - ozornick - 02-14-2024

That's what I want to change. I think the variable in the name is superfluous. This means that it is preferable to change this value somewhere in one place.


RE: Add change view folder for VIew - kenjis - 02-14-2024

I am sorry, but I do not see why the path should be changed during a request.

It is easy to add a setter if you extend the View class. 
I don't see why the setter should be provided to all CodeIgniter users.

The setter only complicates the View class and don't seem to have benefit.


RE: Add change view folder for VIew - ozornick - 02-14-2024

Fine. then let's not waste time on this. I have nothing to add except what I have said.