This is a follow up to show/hide items

I thought id have a stab at explaining my show/hide items. This is specific to Thistle but imsure it can be amnded for others.
Note Ive had to replace the open and close arrow brackets with [ and ] as they wont show up.

First create a file called style.php for example. If we are hiding 2 items called intro and calendar it should contain
[?php
if ($intro) {
setcookie ('introa', $intro, time()+31536000);
}
if ($calendar) {
setcookie ('calendara', $calendar, time()+31536000);
}
header("Location: $HTTP_REFERER");
?]
The first If statements pic up the php variable (index.php?variable=whatever) and save them into cookies named introa and calendara. the only do this if either of them contain a value. The header line sends you back to the original page.

In your flavour file, within the top of the function headblock define the cookie variables as global
global $introa;
global $calendara;


Then within the head content of the flavour file set up the style sheets
$head[] = "[style type="text/css"]
#intro {display: $introa; }
#calendar {display: $calendara; }
[/style]";
This will replace $introa and $calendara with with whatevers in the cookie. If the cookies not yet been defined (IE youve not clicked on the show/hide links yet) its blank but that seems OK as it seems to be the same as block (block shows the object, none hides it)

The where your object is place
$head[] = '[a href="./style.php?calendar=block"]show [/a] | [a href="./style.php?calendar=none"]hide[/a][div id="calendar"]';
before it, this is for the calender item. The first "Show" link calls style.php and tells it calendar is block. The second "Hide" sets it to none. Div id calendar opens the div and names it calendar for the earlier stylesheet.

After your object place
[/div]
Just to end it.

Err, thats it. Im afraid Im not too good at explaining this stuff, due partly to the fact that I use the Patent-Pending "Hit or Miss" System, so Im none too sure how I did it myself, but hopefully itll be useful to someone.
t