` Set Cookie template mod to allow passing date and time (Chris Rybitski ) - Icetips Article
Icetips - Templates, Tools & Utilities for Clarion Developers

Templates, Tools and Utilities
for Clarion Developers

Icetips Article

Back to article list   Search Articles     Add Comment     Printer friendly     Direct link  

Par2: Set Cookie template mod to allow passing date and time
1999-01-28 -- Chris Rybitski
 
I've been experimenting with cookies. My research into the method 'SetCookie' of class 'Httpclass' shows that the method receives 5 parms: Name, Value, Date, Time, and Path (optional). In brief: - 'Name' is the name of the cookie. -'Value' is the value of the cookie. If the value is ''(null), the browser deletes the cookie. -'Date' is the expiration date of the cookie. -'Time' is the expiration time of the cookie -'Path' is where to store the cookie on the client machine (this is best left alone, IMO). The 'SetCookie' CODE template only exposes two of the parms -- Name and Value. Date and Time have initial values of zero, so you are not required to pass them. The method defaults to setting Date to (TODAY() + 28) and Time to CLOCK(). I thought it might be useful to control Date and Time (this is still debatable ). A simple mod to 'ICONNECT.TPL' will allow you to control Date and Time. To find the insert point, search for 'SetCookie'. I've opted to ADD this code template instead of REPLACING the existing 'SetCookie'. This way, I have a choice in the selection. Copy the existing 'SetCookie' code block to the clipboard and paste (insert) it after the default code. Then modify the code to resemble the following: #!------------- CSR Custom mod - cookie w/date and time #! #CODE (CSRSetCookie, 'Set the value of a cookie'), DESCRIPTION('CSRSetCookie(''' & %CookieName & ''',' & %CookieSource & ')'),HLP('~ICCodeSetCookie') #BOXED ('Set Cookie') #DISPLAY ('This code template stores a cookie onto the client computer that can be retrieved at a later date. Note, the cookie is not sent until a new page has been requested by the user.'),AT(,,180) #PROMPT ('Cookie name:', @s255),%CookieName #PROMPT ('New value:', EXPR),%CookieSource #PROMPT ('Exp date:', EXPR),%CookieExpDt #PROMPT ('Exp time:', EXPR),%CookieExpTm #END Broker.Http.SetCookie('%'CookieName',%CookieSource,%CookieExpDt,%CookieExpTm ) #! #!------------- CSR Custom mod - cookie w/date and time This mod has not been thoroughly tested (doing that now), but the cookie is still sent. I just don't know what impact control over date and time really has of yet. N.B.: Date must be at least Today() + 1


Today is November 21, 2024, 7:39 am
This article has been viewed 35314 times.



Back to article list   Search Articles   Add Comment   Printer friendly

Login

User Name:

Password: