MyBB Community Forums

Full Version: Showing a sql result on the header
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I would like to show a value taken from the database on the header, on the middle of my links menu. I have the sql the returns a number, and I would like it to be cached and updated at every minute. Every time a users calls a page a function would check if the time last fetch is higher than 60, if it is, it would query the db again, if not, it would return the cached value.

I know I can use some PHP on templates (where my links are) using conditional templates plugin to access a global class from a template, would I be able to share this cached value among all viewing users?

any (hello word) example showing how to access the db from the template would be very welcome..
Done, I added a method to the plugin php file that makes the request to the database and returns the raw number, I then used JS to get this page and make it as a bdage at the top left corner.

http://forum.antinovaordemmundial.com