ci cookies to show popup-add 1 hr interval - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24) +--- Thread: ci cookies to show popup-add 1 hr interval (/showthread.php?tid=265) |
ci cookies to show popup-add 1 hr interval - cisjackie - 11-15-2014 hi, i am new to php, ci and also in this forum. i want to show a popup-add once an hour. after 1 hour, if the user refreshes the page, the add will be shown again. but if user refreshes the site within 1 hour, the add won't be shown. can i do it using ci built-in class using cookies? or there is any other way. pls suggest... thanks in advance. RE: ci cookies to show popup-add 1 hr interval - Rufnex - 11-16-2014 CI has it out of the box ;o) You should use the session driver instead of the cookie helper. http://www.codeigniter.com/userguide3/libraries/sessions.html#tempdata The example shows a message for 60 seconds. Code: $this->session->set_tempdata('example', 'Hello folks!', 60); The set_tempdate method couldnt called in the same controller method because it would be allways overwritten. So set it from another method or from another controller. RE: ci cookies to show popup-add 1 hr interval - cisjackie - 11-16-2014 thanks Rufnex. i'll try it asap and inform u. |