Welcome Guest, Not a member yet? Register   Sign In
ci cookies to show popup-add 1 hr interval
#1
Star 

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.
Reply
#2

CI has it out of the box ;o) You should use the session driver instead of the cookie helper.

http://www.codeigniter.com/userguide3/li...l#tempdata

The example shows a message for 60 seconds.

Code:
$this->session->set_tempdata('example', 'Hello folks!', 60);

later in your workflow you can call.

echo $this->session->tempdata('example');

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.

Reply
#3

thanks Rufnex. i'll try it asap and inform u.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB