Awhile back I started a total recode of the Hosting Fanatic base code. I made many strange choices with it that I often wonder about. One of these days maybe I’ll find a way to benchmark the load HF causes on the server in comparison to other sites.
One of the strange things I did was to make HF pure HTML files with a parser that returned the file after running it through a series of modules. In essence, each page is an HTML file that ,upon request, is pulled into the parser. The parser then loads certain modules based on conditions or even tags inside the file. Once the modules have done their work the parser outputs the file through a translation function that has yet to be filled in.
As an example, one of the modules that is usually loaded is a site spider for HF. This particular module is loaded when it is determined that the page has yet to be spidered or if the file mod time is off from the spidered version. When it is loaded it runs through a series of checks to decide whether the page should be spidered or not. One tag it checks for is . If all is well it generates a page description and title and then saves the page in a database. This information is used to build RSS feeds and the RSS site map.
The translation function I mentioned is one I haven’t found a proper solution for yet. I was hoping to find some sort of open source translation solution that would allow for to cache translated versions of HF pages in may different languages. With the use of domain aliases and sub domains I was hoping to set sites up like fr.hostingfanatic.com where each sub domain would translate into a different language. The way HF was built makes this very possible if I could find the right solution.
As of late I have become very liberal with MySQL queries on many of Hosting Fanatic’s pages. This is mainly due to a dynamic query/template function where I can use a tag to query a MySQL database and specify a template file to pretty the results up with. All the hosting provider lists you see are generated this way. The module automatically assumes the template for no results is the same as the results template with no_ preceding the file name. This comes in handy big time but it is very easy to get carried away.
Many of these queries, however, are not the kind I would need to run again and again. Running them every few hours would be sufficient to keep up with changes. In light of this, what I did was to add a caching feature to the function responsible for running MySQL queries and converting the results to an array. Prepending @ to the front of the query will suppress caching functionality. Leaving it off will cause the query to be cached outside web root as a serialized array. When a query is run without @ then cache is checked for results and returned by the function. All this is limited to simple SELECT statements.
When you go to a page on Hosting Fanatic you can often check this by viewing page source and scrolling to the bottom. You should see something like telling you how many times the query function had to actually run a query.

Blink
Del.icio.us
Digg
Furl
Google
Simpy
Spurl
Y! MyWeb