[Zope] How to personalise a website? (or..rather : how to set and erase cookies)

Geir Bækholt lists at elvix.com
Tue Aug 19 12:15:57 EDT 2003


On  Tue, 19 Aug 2003 10:59:12 +0200 GMT 
Børge Kjeldstad asked the Zope mailinglist about the following:

> Now, I am also slightly aware of that there is some parameter option
> in the “setCookie” statement. That is: I could maybe have a
> setCookie statement that went like this:
 
>   <dtml-call expr="RESPONSE.setCookie('guest', ‘B’)">

Yes, but use normal single quotes if it is just a string:

<dtml-call expr="RESPONSE.setCookie('guest', 'B')">

> and then use or change the parameter to the cookie “guest” My second
> question is hence; if this would be a better solution than trying to
> erase the cookie as previously described.
 
Your final idea here is probably the one you want, as it would not erase the
prevoius cookie before your guest had chosen a new one.
<dtml-call expr="RESPONSE.setCookie('guest', 'C')">

for erasing cookies : set them to expire some point of time in the
past. There might even be a method RESPONSE.expireCookie('guest') ,
but you will have to check the API docs for this..

hint : Don't get started too much on DTML. Use python-scripts for
things like this, and ZPT for presentation.

:)

--
Geir Bækholt




More information about the Zope mailing list