Freshly Pressed

Web hosting with an emphasis on SUPPORT. Now there's a novel idea…

Minimize PHP and Database Queries

page_php_128

Why?

Because each time a page on your site loads, if your browser has to execute any PHP queries, it adds to the load time. So, the obvious thing to do to reuce this waste of time is to replace the PHP queries with static HTML. That way, every time a page loads, your browser just reads the HTML instead of having to contact the database.

I have found myself thinking quite a lot about this recently, with making a new theme. Because a theme is for multiple users, you have no choice but to make it do a lot of queries, but if you are happy with your chosen theme, why not take a minute to look through and see what changes you can make.

Here is a typical example:

Often in the header of a theme you will see the following or similar:

<?php bloginfo('name'); ?>

This will mean the site, when loading, will do a database query to find the domain name. To stop this from happening, you simply need to enter the domain name yourself and remove the query. Of course, if you only have a couple you will not notice much in terms of gained speed on your site, but if there are many – and that is more often than not, the case with many themes – then making these changes will make a significant difference.

Subscribe

Related Posts:

Uptime – Downtime – September 2010

Tell me and I'll forget; show me and I may remember; involve me and I'll understand. - Chinese Proverb 236

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

EXCELLENT OFFERS

OffersTake a look at some of our great offers that are currently available! SAVE! SAVE! SAVE!

HTML, CSS AND MORE...

HTML, CSS and moreEverything from CSS, WordPress tips and tricks and everything in between - GO GET IT NOW!

FRESHLYPRESSED WEB DESIGN

DesignTake a moment to visit our portfolio. Aesthetics and functionality actually DO matter!.