craigf136 Posted January 15, 2015 Posted January 15, 2015 What would be the best way to save a background choice to cookie in IPS V4?I'm thinking of supplying our users the choice of background but I would need this to be saved to cookie, anyone know the best way to achieve this in IPS V4?
craigf136 Posted February 22, 2015 Author Posted February 22, 2015 Anyone any ideas? Would appreciate the help.
Ryan Ashbrook Posted February 23, 2015 Posted February 23, 2015 In PHP: \IPS\Request::i()->setCookie(); /** * Set a cookie * * @param string $name Name * @param mixed $value Value * @param \IPS\DateTime|null $expire Expiration date, or NULL for on session end * @param bool $httpOnly When TRUE the cookie will be made accessible only through the HTTP protocol * @param string|null $domain Domain to set to. If NULL, will be detected automatically. * @param string|null $path Path to set to. If NULL, will be detected automatically. * @return bool */ public function setCookie( $name, $value, $expire=NULL, $httpOnly=TRUE, $domain=NULL, $path=NULL ) In JavaScript: ips.utils.cookie.set() /** * Set a cookie value * * @param {string} cookieKey Key to set * @param {mixed} value Value to set in this cookie * @param {boolean} sticky Whether to make this a long-lasting cookie * @returns {void} */ set = function( cookieKey, value, sticky )
Recommended Posts
Archived
This topic is now archived and is closed to further replies.