[pmwiki-users] Something between setskin= and skin=

Sandy sandy at onebit.ca
Thu Jan 31 15:57:26 CST 2008


Patrick R. Michaud wrote:
> On Thu, Jan 31, 2008 at 03:18:04PM -0500, Sandy wrote:
>> Is there something between setskin= and skin= ?
>>
>> What I'd like is an option to keep the skin for the session, unless of 
>> course the user changes it, but to revert to the default skin when he 
>> closes the browser. This way, if you are showing off how easy it is to 
>> change skins, your user [1] can easily change it back.
>>
>> [1] who naturally won't remember the "you have to do it yourself by 
>> clicking here" instructions, especially after he's seen that, yes, the 
>> entire site has the skin he chose.
>>
>> There's nothing in skinchange.php's documentation for this.
> 
> To change the skin setting to a per-session one, simply set:
> 
>     $SkinCookieExpires = 0;
> 
>> A variable set in the link would be the most flexible, maybe 
>> setskinsession=skinname . That way knowledgeable users could choose at 
>> the time.
> 
> You could also allow the expiration time as an options, by adding:
> 
>     if (isset($_REQUEST['skinexpires']))
>         $SkinCookieExpires = 0 + $_REQUEST['skinexpires'];
> 
> Then one can do ?setskin=foo&skinexpires=86400 to get the setting
> to last for 24 hours.  Or, to be really fancy, perhaps:
> 
>     if (isset($_REQUEST['skinexpires'])) {
>         list($g0,$g1) = DRange($_REQUEST['skinexpires']);
>         $SkinCookieExpires = $g0;
>     }
> 
> Then one can actually use a real date for expiration, as in:
> 
>     ...?setskin=foo&skinexpires=2009-01-01
>     ...?setskin=foo&skinexpires=tomorrow
> 
> Pm

Awesome! (You guys make it look so easy.)

Sandy




More information about the pmwiki-users mailing list