On Fri, 25 Aug 2000, Jean Jordaan wrote:
<dtml-if "REQUEST.form.has_key('sort_key')"> <dtml-call "REQUEST.set('sort_key', REQUEST.form['sort_key'])"> <dtml-call "RESPONSE.setCookie('sort_key', REQUEST.form['sort_key'])"> <dtml-else> <dtml-if "REQUEST.cookies.has_key('sort_key')"> <dtml-call "REQUEST.set('sort_key', REQUEST.cookies['sort_key'])"> <dtml-else> <dtml-call "RESPONSE.setCookie('sort_key', 'title')"> <dtml-call "REQUEST.set('sort_key', 'title')"> </dtml-if "REQUEST.cookies.has_key['sort_key']"> </dtml-if "REQUEST.form.has_key('sort_key')">
[...]
<dtml-if "sort_key=='title'">
Since anything in any of the REQUEST dictionaries is on the name space stack, you should be able to reduce the above IF block to: <dtml-if sort_key> <dtml-if "REQUEST.form.has_key('sort_key')"> <dtml-call "RESPONSE.setCookie('sort_key',REQUEST.form['sort_key'])"> </dtml-if> </dtml-else> <dtml-call "REQUEST.set('sort_key','title')"> <dtml-call "RESPONSE.setCookie('sort_key','title')"> </dtml-if> If the 'cookie' dictionary is "closer" than the 'form' dictionary in the namespace stack you'd need to stick one more REQUEST.set in the inner if. Obviously, I haven't tested this :) --RDM