Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Perl Misc (http://www.velocityreviews.com/forums/f67-perl-misc.html)
-   -   setting cookie works, but editing doesn't (http://www.velocityreviews.com/forums/t896805-setting-cookie-works-but-editing-doesnt.html)

ca@psver.net 03-01-2006 09:59 AM

setting cookie works, but editing doesn't
 
I'm using about 30 blocks with links on my page, that can be opened or
closed by users so they're able to select which links should be
displayed on their 'personal' page.

Just closing blocks for the first time works fine, but returning
visitors that want to open or close a new block, lose their first
setting, everything in the cookie is replaced.

I use this code, anyone got an idea? I spent days figuring it out! It
drives me crazy!


function toggle(t) {

var para=document.getElementById(t);
var tb = document.getElementById('t' + t);
var htb = document.getElementById('h' + t);

var v = GetCookieOpenClose('l');

if(para.style.display!='none') {

para.style.display = 'none';
tb.style.display = 'block';
htb.style.display = 'none';

if (v!=null) {
v += "|" + t;
} else {

v = "|" + t;
}

SetCookieOpenClose('l',v);

}
else {

para.style.display = 'block';
tb.style.display = 'none';
htb.style.display = 'block';

if (v!=null) {
v = v.Replace("|" + t,"");
}

SetCookieOpenClose('l',v);

}

v = GetCookieOpenClose('l');

return true;
}


Gunnar Hjalmarsson 03-01-2006 10:21 AM

Re: setting cookie works, but editing doesn't
 
ca@psver.net wrote:
> I'm using about 30 blocks with links on my page, that can be opened or
> closed by users so they're able to select which links should be
> displayed on their 'personal' page.
>
> Just closing blocks for the first time works fine, but returning
> visitors that want to open or close a new block, lose their first
> setting, everything in the cookie is replaced.
>
> I use this code, anyone got an idea? I spent days figuring it out! It
> drives me crazy!


You should have spent a minute figuring out an appropriate Usenet group.
This group is about Perl.

<JavaScript(?) code snipped>

--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl

Tintin 03-02-2006 07:49 AM

Re: setting cookie works, but editing doesn't
 

<ca@psver.net> wrote in message
news:1141207150.482239.180520@i39g2000cwa.googlegr oups.com...
> I'm using about 30 blocks with links on my page, that can be opened or
> closed by users so they're able to select which links should be
> displayed on their 'personal' page.
>
> Just closing blocks for the first time works fine, but returning
> visitors that want to open or close a new block, lose their first
> setting, everything in the cookie is replaced.
>
> I use this code, anyone got an idea? I spent days figuring it out! It
> drives me crazy!
>
>
> function toggle(t) {
>
> var para=document.getElementById(t);
> var tb = document.getElementById('t' + t);
> var htb = document.getElementById('h' + t);
>
> var v = GetCookieOpenClose('l');
>
> if(para.style.display!='none') {
>
> para.style.display = 'none';
> tb.style.display = 'block';
> htb.style.display = 'none';
>
> if (v!=null) {
> v += "|" + t;
> } else {
>
> v = "|" + t;
> }
>
> SetCookieOpenClose('l',v);
>
> }
> else {
>
> para.style.display = 'block';
> tb.style.display = 'none';
> htb.style.display = 'block';
>
> if (v!=null) {
> v = v.Replace("|" + t,"");
> }
>
> SetCookieOpenClose('l',v);
>
> }
>
> v = GetCookieOpenClose('l');
>
> return true;
> }


You need to fix all your Perl errors first.

$ perl -cw foo
Unquoted string "t" may clash with future reserved word at foo line 1.
Unquoted string "document" may clash with future reserved word at foo line
3.
Unquoted string "t" may clash with future reserved word at foo line 3.
Unquoted string "document" may clash with future reserved word at foo line
4.
Unquoted string "t" may clash with future reserved word at foo line 4.
Unquoted string "document" may clash with future reserved word at foo line
5.
Unquoted string "t" may clash with future reserved word at foo line 5.
Unquoted string "para" may clash with future reserved word at foo line 9.
Unquoted string "style" may clash with future reserved word at foo line 9.
Unquoted string "display" may clash with future reserved word at foo line 9.
Unquoted string "para" may clash with future reserved word at foo line 11.
Unquoted string "style" may clash with future reserved word at foo line 11.
Unquoted string "display" may clash with future reserved word at foo line
11.
Unquoted string "tb" may clash with future reserved word at foo line 12.
Unquoted string "style" may clash with future reserved word at foo line 12.
Unquoted string "display" may clash with future reserved word at foo line
12.
Unquoted string "htb" may clash with future reserved word at foo line 13.
Unquoted string "style" may clash with future reserved word at foo line 13.
Unquoted string "display" may clash with future reserved word at foo line
13.
Unquoted string "v" may clash with future reserved word at foo line 15.
Unquoted string "null" may clash with future reserved word at foo line 15.
Unquoted string "v" may clash with future reserved word at foo line 16.
Unquoted string "t" may clash with future reserved word at foo line 16.
Unquoted string "v" may clash with future reserved word at foo line 19.
Unquoted string "t" may clash with future reserved word at foo line 19.
Unquoted string "v" may clash with future reserved word at foo line 22.
Unquoted string "para" may clash with future reserved word at foo line 27.
Unquoted string "style" may clash with future reserved word at foo line 27.
Unquoted string "display" may clash with future reserved word at foo line
27.
Unquoted string "tb" may clash with future reserved word at foo line 28.
Unquoted string "style" may clash with future reserved word at foo line 28.
Unquoted string "display" may clash with future reserved word at foo line
28.
Unquoted string "htb" may clash with future reserved word at foo line 29.
Unquoted string "style" may clash with future reserved word at foo line 29.
Unquoted string "display" may clash with future reserved word at foo line
29.
Unquoted string "v" may clash with future reserved word at foo line 31.
Unquoted string "null" may clash with future reserved word at foo line 31.
Unquoted string "v" may clash with future reserved word at foo line 32.
Unquoted string "v" may clash with future reserved word at foo line 32.
Unquoted string "t" may clash with future reserved word at foo line 32.
Unquoted string "v" may clash with future reserved word at foo line 35.
Unquoted string "v" may clash with future reserved word at foo line 39.
Unquoted string "true" may clash with future reserved word at foo line 41.
syntax error at foo line 1, near ") {"
syntax error at foo line 42, near "}"
foo had compilation errors.




All times are GMT. The time now is 05:53 AM.

Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.