News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

Changing theme variants without changing pages.

Started by Antechinus, June 24, 2009, 09:10:50 PM

Previous topic - Next topic

Antechinus

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.

[SiNaN]

This should work:

echo '<a href="' . $_SERVER['REQUEST_URL'] . (strpos($_SERVER['REQUEST_URL'], '.php?') !== false ? ';' : '?') . 'variant=whatever">Change it!</a>';
Former SMF Core Developer | My Mods | SimplePortal

Antechinus

It does. :D I combined it with the other code here and now have a changer that will change the variants permanently and without changing your location in the forum. Awesomesauce. Couldn't be better.

Advertisement: