Hello! I want to personalize a website. That is; I have a welcome page with some links on, say link A, B and C. If a guest presses link B I want that to affect the design of all the later pages that this guest sees. However, if the guest returns to the welcome page and presses link C, I want all the following pages that this guest sees, to have some other look (the C look). I am not so good at programming in python so I guess my easiest shot will be to use cookies (please correct me if I am wrong:-)). Now, I found some example in the Zope book. If the guest chooses link B I could set a cookie using the following statement: <dtml-call expr="RESPONSE.setCookie('guest_B')"> and then later for the page design, use some if statement like this: <if request.cookies.has_key('guest_B'> (Please correct me if the program lines here are wrong:-), I am really not sure about how to use the apostrophe sign in these statements) But if the guest now goes back to the welcome page and chooses link C he or she will still have the guest_B cookie. My question is then: How do I erase the guest_B cookie? 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)"> 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. Thank you very much! Børge Kjeldstad
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
participants (2)
-
Børge Kjeldstad -
Geir Bækholt