RE: dynamically updating site

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> I looking for a way to update certain parts of a site that is highly
> dynamic. I've tried creating static files via cronjobs then including
> them,
> but it is a pain to do. for instance, i have a news page that utilizes
> mysql, rather than query the DB on each page load i would like to have it
> update at say 5 minute intervals.. not sure if this is possible to do
> without generating static files..
> 
> any suggestions?

I can't see why you couldn't have a class that you call at the top of the
page that checks the date/time of the 'static' page, generates the content
into the static page from the DB if older than 5 minutes and then passes to
displaying the content of that static page.

In pseudo-logic, this would be something like:

If datetime_of_static_news_page > 5 minutes ago:
	Replace content of static news page with data from db
End if
Display content of static news page

I doubt there'd be significant overhead in the static page generation, since
it would only be called once per 5 mins. Though, I guess it depends on
exactly how much data / markup / etc is going into that page, and the
tradeoff between writing the file and then displaying it versus whatever
performance concern you're attempting to address in hitting the db each time
the page is viewed.

Regards,

Murray

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux