A lot of people have complained about how the CSS Switcher plugin redirects you back to index.php after choosing a new option, no matter what page you are coming from. The below page will make sure visitors will end up back at the page they were when choosing a new option.
Additionally, two extra lines of PHP coding have been inserted to strip the URL of anything after a ?. Usually after choosing a new option from the CSS Switcher, visitors are redirected to “page/?css_skin=1”. If they want to choose another skin without going to a new page, they’d get sent back to “page/?css_skin=1?css_skin=2”, which obviously doesn’t exist. The extra lines of PHP coding prevent that.
The code example below shows how to use this with a form dropdown, as well as with normal a href links. Please note that PHP needs to be enabled for the template you’re using this on.
<?
$css_refer= $_SERVER ['REQUEST_URI'];
$css_refer = explode("?", $css_refer);
?>
<form action="<?=$css_refer[0]?>" method="post">
<select name="css_skin" id="css_skin">
<option value="1">Option 1</option>
<option value="2">Option 2</option>
</select>
<input type="submit" />
</form>
<ul>
<li><a href="<?=$css_refer[0]?>?css_skin=1">1</a></li>
<li><a href="<?=$css_refer[0]?>?css_skin=2">2</a></li>
</ul>
Category:Templates Category:PHP Category:Plugins
