CodeIgniter Forums
Add variables in routes with 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 variables in routes with view (/showthread.php?tid=91765)



Add variables in routes with view - witezak - 10-06-2024

Add the ability to pass simple variables in the route for views. Sometimes we derive a route from a template where we want to pass a title or fixed variable, but it's not possible.

An example of how this would be used:

PHP Code:
$routes->view('/''login', ['title' => 'Login''message' => 'Welcome to login']);

$routes->view('change-password''change-pass', ['title' => 'Change Password']); 



RE: Add variables in routes with view - ozornick - 10-06-2024

What for? You think only to yourself) Routes are not always used for HTTP, there is a CLI. The functionality will not be shared. Better apply the parameters in the controller, filter, and view decorator...