In javascript we have
setInterval("alert(1)", 1000*60*30);to display a message for every 30 minutes
Similary is there any php function that displays a message for every 30 minutes.
Any other solutions ?
Thanks in advance
displays a message for every 30 minutes
Moderator: General Moderators
-
marty pain
- Forum Contributor
- Posts: 105
- Joined: Thu Jun 11, 2009 5:32 am
- Location: Essex
Re: displays a message for every 30 minutes
Because web applications are stateless there isn't a way of scheduling tasks as such, but there are ways that can mimic that behaviour.
One answer -> If your site runs through a central page, and this page is used every time an action is performed on your application, then you can use that page to check the time of the action against a time stored in a file/database. If 30 minutes hasn't passed since the last action do nothing, if it has, display the message and reset the message to thirty minutes in the future.
One answer -> If your site runs through a central page, and this page is used every time an action is performed on your application, then you can use that page to check the time of the action against a time stored in a file/database. If 30 minutes hasn't passed since the last action do nothing, if it has, display the message and reset the message to thirty minutes in the future.
Re: displays a message for every 30 minutes
No, because PHP does not continue to run after it has sent the page to the browser. Its job is done. Thus, you must do this sort of thing in the browser, which means you must use a client-side language like Javascript.sobha wrote:In javascript we have
setInterval("alert(1)", 1000*60*30);to display a message for every 30 minutes
Similary is there any php function that displays a message for every 30 minutes.
- Bill H
- DevNet Resident
- Posts: 1136
- Joined: Sat Jun 01, 2002 10:16 am
- Location: San Diego CA
- Contact:
Re: displays a message for every 30 minutes
You can run cron jobs on the (*nix) server at set intervals, but they would not be targeted at a particular browser.
Which points out the difference between a server side and client side language. It isn't just a different language, you are actually controlling two completely different environments. I think that point gets missed a lot.
Which points out the difference between a server side and client side language. It isn't just a different language, you are actually controlling two completely different environments. I think that point gets missed a lot.
Re: displays a message for every 30 minutes
Good way to present it.Bill H wrote:Which points out the difference between a server side and client side language. It isn't just a different language, you are actually controlling two completely different environments. I think that point gets missed a lot.