changing session based on route - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=11) +--- Thread: changing session based on route (/showthread.php?tid=68595) |
changing session based on route - alexisbix - 08-02-2017 Hi! I was wondering if anyone could help me: I have the following controller/function I want to make a route that goes: {some_text}/controller/function routes to controller/function The only difference is that the value of some_test willl change a config/session/global variable in the controller. So something in route, or construct of the controller that can extract the some_text and set it in the session? Thanks in advance! RE: changing session based on route - skunkbad - 08-02-2017 After routing you do have access to the routed segments: https://www.codeigniter.com/userguide3/libraries/uri.html#CI_URI::rsegment RE: changing session based on route - alexisbix - 08-02-2017 Ah that makes sense! Though I should mention, after testing, clearly rsegment is the routed segment as you said, though in this case I wanted the segment that is in the URL in the user's browser to set the session |