[pmwiki-users] httpvariables

Martin Fick mogulguy at yahoo.com
Thu Mar 20 14:29:02 CDT 2008


--- noskule <noskule at gmx.net> wrote:
> I'm looking for a way to set coockies via url link
> but can't find a way how to apply the changes
without
> reloading the page for a secound time.

Well, that is not really possible due to the nature of
cookies.  Since they are set in your browser and need
to be set before they are sent, it takes one page load
to set it, and one page load to send it.

This having been said, there are certainly
hacks/workarounds that might satisfy your needs:  page
redirects, javascript hacks...


> @Martin: could you provide an option for setting the
> path where the cookie is uses eg.
>     (:cookie sectionborders 1 {*$Group}:)


> Test:
> (:if equal {$@sectionborders} 1:)
> border: yes
> (:else:)
> border: no
> (:ifend:)
> 
> Config  Links:
> (:if equal {$@sectionborders} 1:)
> * [[{*$FullName}?sectionborders=0|Hide
> Sectionborder]]
> (:else:)
> * [[{*$FullName}?sectionborders=1|Show
> Sectionborder]]
> (:ifend:)
> 
> Set Cookies:
> (:if equal {$?sectionborders} 1:)
> (:cookie sectionborders 1:)
> (:else:)
> (:cookie sectionborders 0:)
> (:ifend:)


Perhaps the easiest thing to do is to simply check for
REQUEST variables in your test instead of cookies
specifically (use the ! instead of @).  This way on
the first page load (the one that sets the cookie),
you will trigger the test with the the GET value, and
on subsequent loads with the cookie value.  i.e.:

 (:if equal {$!sectionborders} 1:)
 border: yes
 (:else:)
 border: no
 (:ifend:)

-Martin



      ____________________________________________________________________________________
Looking for last minute shopping deals?  
Find them fast with Yahoo! Search.  http://tools.search.yahoo.com/newsearch/category.php?category=shopping




More information about the pmwiki-users mailing list