I have a blog where I want the user to click a link to be able to invert the colour scheme (from dark on light to light on dark). This link will be available on each page of the blog.
If I wasn't using CodeIgniter, I would create a link with a parameter (e.g. "index.php?inverted=true") and in my controller detect if $_GET['inverted'] was set, set a $_SESSION variable. The link would be changed and the additional CSS file would be added when $_SESSION is set. The link's new href would be something like "index.php?inverted=false" and the $_SESSION variable would be unset. It would work site-wide and regardless of the rest of the URI.
I've tried using the uri_segement functions in CodeIgniter, but because this needs to be across the whole site, my URIs change (sometimes just "index.php/controller/function", other times "index.php/controller/function/para1/para2/para3"). Therefore I can't just make my link: [href="$_SESSION['REQUEST_URI'] . "/inverted"] and then detect if that URI segment exists because I don't know which number the segment "inverted" would be. Also, if a user is on the same page and clicks the link twice, the URI keeps adding "/inverted" again and again.
I made a mock form so I could use the $_POST array instead, but I know this isn't good practice.
Any suggestions?