PDA

View Full Version : Functions for setting and getting cookies?


ToryS
10-11-2007, 11:19 AM
Namely the Collapse cookies. I am trying to write a script, but for some reason my cookies aren't being fetched to set the tbody style to be none or empty.

Sorry if I am not explaining it clearly, but I am not sure how to say what I am trying to do, hehe.

It has something to do with $vbulletin->GPC['vbulletin_collapse'], but I can't figure out how exactly that function works.

Does anyone know how to save collapsed/expanded tables?

To clear things up a bit, when I click the expand/collapse image, the cookie DOES get written. The thing I am having problems with is the cookie getting pulled and set when the page reloads.

Analogpoint
10-11-2007, 02:40 PM
The cookie is read automatically in global.php

All you have to do is create your collapsible box correctly.

Replace what's in red

<table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="180">
<thead>
<tr>
<td class="thead">
<a style="float:$stylevar[right]" href="#top" onclick="return toggle_collapse('MYBOX')"><img id="collapseimg_MYBOX" src="$stylevar[imgdir_button]/collapse_thead$vbcollapse[collapseimg_MYBOX].gif" alt="" border="0" /></a>
TITLE HERE
</td>
</tr>
</thead>
<tbody id="collapseobj_MYBOX" style="$vbcollapse[collapseobj_MYBOX]">
<tr>
<td class="alt1" nowrap="nowrap">CONTENTS HERE</td>
</tr>
</tbody>
</table>

ToryS
10-12-2007, 12:24 PM
Ohh okay, I don't know why I didn't even think about that.

Thanks!