Hi all,
Your thoughts on the scenario I have at the moment would be greatly appreciated.
Currently I have a php file which depending on some condition sets a variable in the response header to true or false.
I then have an xsl template that contains some javascript which checks whether the variable is set to true or false (jquery.post). Depending on the result, if its on I use some jquery to add a particular class to a particular div tag and if its off I remove a particular css class from a div tag. I also apply some javascript depending on the condition.
This is done for every page load. Can I somehow do this all in php which runs on the server side every 5 minutes instead of taxing the client every page refresh?
If yes, how can this be done?
Thanks as always
Php, javascript and Css
Moderator: General Moderators
- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
Re: Php, javascript and Css
This is done for every page load. Can I somehow do this all in php which runs on the server side every 5 minutes instead of taxing the client every page refresh?
You can run a cron job to run every 5 which sets a variable, probably stored in the database, then your script simply checks the value in the database when the page loads. If you want to update the client if they leave their browser open for 5 minutes, then your current strategy is what you'd want to do.
You can run a cron job to run every 5 which sets a variable, probably stored in the database, then your script simply checks the value in the database when the page loads. If you want to update the client if they leave their browser open for 5 minutes, then your current strategy is what you'd want to do.