Welcome Guest, Not a member yet? Register   Sign In
enable users to define their own routes
#1

In CI3 application I've created a page to allow users to update routes, because it was so simple - I had to load and update an array only. 

Here I can see that it is not so simple any more. So can anyone suggest what is the best approach for me to enable users to update routes as they need?
Reply
#2

You can map an entire array in CI4 as well.
https://codeigniter.com/user_guide/incom...ple-routes

But you need to write your own code get it there. Depending on how you do it, that can be a security risk, if you allow them to manipulate it without validation.
Reply
#3

(08-16-2020, 07:16 AM)jreklund Wrote: You can map an entire array in CI4 as well.
https://codeigniter.com/user_guide/incom...ple-routes

But you need to write your own code get it there. Depending on how you do it, that can be a security risk, if you allow them to manipulate it without validation.

Thank you. So basically I can use the same Routes.php from CI3, I just need to load it and map it in CI4. Can you suggest the best place to store that PHP array file in CI4 for structure?
Reply
#4

If your users change it from a GUI, you generally save it in the database, so you grab it from there. Or you save it as a JSON file that you grab from your Routes.php and load it.
Reply
#5

(08-16-2020, 07:28 AM)jreklund Wrote: If your users change it from a GUI, you generally save it in the database, so you grab it from there. Or you save it as a JSON file that you grab from your Routes.php and load it.

My CMS is file based, so everything is saved in folders. So if it is a json file, where should I save it?
Reply
#6

In a folder not accessible from any URL.
Reply
#7

(08-16-2020, 08:52 AM)jreklund Wrote: In a folder not accessible from any URL.

OK, I can create a folder named for ie, "settings" under the app folder, and store configurable things there. Thanks so much for your support. I will continue using and promoting codeigniter.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB