Ok, I'm having problems, can anyone figure out how to get this to work with my "hide the sidebar" code....
I have this in my main template
PHP Code:
<table align="center" class="page" cellspacing="0" cellpadding="0"width="100%">
<tr valign="top">
<if condition="$show['left_column']">
<td width="175" id="collapseobj_gtpcloseleftcol" style="$vbcollapse[collapseobj_gtpcloseleftcol]">
And this is my navbar link before adding the plugin(works but doesn't keep settings between pages hence the need for a cookie...)
PHP Code:
<a href="#top"
onclick="toggle_collapse('gtpcloseleftcol')">SideBar</a>
This is the code I have in my plugin just as suggested in the previous post
PHP Code:
$show['left_column'] = true;
if ($_REQUEST['do'] == 'hidesidebar')
{
vbsetcookie('hidesidebar', 1, true);
}
if ($_REQUEST['do'] == 'showsidebar')
{
vbsetcookie('hidesidebar', 0, true);
}
$cookiename = COOKIE_PREFIX . 'hidesidebar';
$vbulletin->input->clean_gpc('c', $cookiename, 'TYPE_INT');
$sidebar = $vbulletin->GPC["$cookiename"];
if ($sidebar == 1)
{
$show['left_column'] = false;
}
This is the nav bar link after the plugin code has been added
PHP Code:
<if condition="$sidebar == 0"><a href="./index.php?do=hidesidebar">Hide</if><if condition="$sidebar == 1"><a href="./index.php?do=showsidebar">Show</if></a>
Now... the page takes 2 clicks of either link before it will swap to the other link and the sidebar does not go away... I'm stumped... can anyone help me figure this out? Also, is there another way to do the link so it doesn't force them back to the index page but will leave them on the page they are on like the old (cookieless) code does?