Simple Machines Community Forum

Customizing SMF => SMF Coding Discussion => Topic started by: Antechinus on June 24, 2009, 09:10:50 PM

Title: Changing theme variants without changing pages.
Post by: Antechinus on June 24, 2009, 09:10:50 PM
I know you can use header links such as <a href=" ' . $scripturl . '?variant=whatever"> for changing theme variants but this will redirect to the home page.

How can I change the url so that regardless of where someone is on the site they can change theme variants on a whim without being redirected to the home page?
In other words, I want the theme variant to change without moving the view from the current page.
Title: Re: Changing theme variants without changing pages.
Post by: [SiNaN] on July 22, 2009, 11:30:10 AM
This should work:

echo '<a href="' . $_SERVER['REQUEST_URL'] . (strpos($_SERVER['REQUEST_URL'], '.php?') !== false ? ';' : '?') . 'variant=whatever">Change it!</a>';
Title: Re: Changing theme variants without changing pages.
Post by: Antechinus on August 06, 2009, 03:32:59 AM
It does. :D I combined it with the other code here (http://www.simplemachines.org/community/index.php?topic=315942.msg2171251#msg2171251) and now have a changer that will change the variants permanently and without changing your location in the forum. Awesomesauce. Couldn't be better.