I’m setting up a website where visitors will be greeted by a splash screen where they will choose a color scheme for the actual website; based on their selection, the actual website will load with a different stylesheet. I gather this can be done by concatenating a flag to the URL, then reading the flagged URL on the next page to determine the stylesheet to be loaded (for example, to load the dark theme, the url would become http://www.mywebsite.com/index-dark; clicking the light theme link would make the URL http://www.mywebsite.com/index-light. Problem is, I don’t know how to add a flag to a URL, or how to read this flag on a different page. I’ve tried Googling the issue, but have found little practical information. How can this be done?
EDIT: I’d like to avoid using two separate pages, as I’ll have multiple themes; that would mean copying basically every HTML page in my root multiple times, taking up space. I like the idea of a concealed $_GET variable, though.
The “flags” you’re mentioning are probably actually
$_GETvariables that have been disguised usingmod_rewrite. What you can do is edit your.htaccessfile to add in rewrite rules that change, say,www.mywebsite.com/index.php?style=index-darktowww.mywebsite.com/index-dark(unfortunately I don’t have experience in how exactly to do this; I just know that it can be done) and have your PHP catch$_GET['style'].