I'm not sure I'm going down the right path with this - and I am pretty new to routing, so if this is way off base, I apologize.
What I'm trying to accomplish is having a link at the bottom of the page where the site visitor can select mobile or full screen. I want them to be able to do this from any page. When they select either one, there could be any number of things happen - depending on where they are on the site (i.e. different views, functionality, etc).
Right now, I don't have Codeigniter configured to allow querystrings, which is the default behavior. So in order to pass a preference in a link, I need to do it using a url segment.
I was hoping to do something like:
<? if ($in_mobile_view): ?>
Mobile | <a href="<?= current_url() ?>/f">Full Site</a>
<? else: ?>
<a href="<?= current_url() ?>/m">Mobile</a> | Full Site
<? endif ?>
This works great when I am navigating to: /welcome/index/m or /calendar/view/m, etc. However, if I'm just at: /welcome/m or /m - where the index method of the controller should kick in, I get a 404 because it can't find the method - since it doesn't exist.
My thought was that via routing, I could configure Codeigniter to ignore the "m" and "f" strings and just operate as if they aren't in the url at all.
Is that a good way to go about this? If not, I'd love to hear other suggestions. If this is a decent way to go, I'd really appreciate if someone could point me in the right direction for routing.
Thanks for your time.