RSS iconRSS       Email iconEMAIL
vertical spacer

Blog: Web Development

Wordpress formatting and read more link issues when using WP_Query(”)

Friday, February 12th, 2010

 As much as anything this post is a note to my self for future reference.

When using the WP_Query() routine in Wordpress to create custom blog post loops, quite often there are issues with the formatting and rather than just showing your post content before the 'read more' link it shows the whole post even though you have the code in place to cut the post off at 'read more'. (more...)

Using jQuery to hide/show a number of elements with ease

Saturday, November 28th, 2009

SIMONR85 over in the affiliates4u forum posted a PHP related query. He initially wanted to show 3 products from a database then when a user clicks a "show more" link 30 products would be visible. This can be acheived quite easily in PHP but I personally think jQuery would be much more suited to the job. Using jQuery would cut down on server calls while at the same time presenting more information for search engines.

So here is a crude example:

(more...)

Combining jQuery validation with jQuery tooltip.

Wednesday, July 1st, 2009

In an effort to improve usability and reduce server calls on a complex form, I've been implementing jQuery's validation plugin.  jQuery makes it extremely easy to validate a form with minimal code.  I wasn't happy with the default style of error message, I  didn't want a large line of error text disrupting the structure of my form. I wanted a simple icon to indicate there was an error and when the user hovers over the icon I wanted to utilise jQueries tooltip plugin to explain the error. I had a good search on the internet but couldn’t find a solution. What I did find was lots of other people in the same situation.

Now I've successfully managed to combine jQuery validation with the tooltip plugin I thought I had better share it.
(more...)

Going Mobile

Sunday, November 9th, 2008

Nowadays mobiles don't seem to be getting any smaller, instead they are becoming more powerful, almost like tiny laptops. With mobile download speeds improving massively and networks including unlimited data on some tariffs, internet usage on mobile devices is only going to increase. GPS, high resolution cameras, accelerometers, 8GB + memory, wifi, permanent internet connectivity; the application potential is enormous.

Mobile applications will see explosive growth in the next few years.

Don’t Use require() or include() to include dynamic pages from remote sources

Tuesday, November 20th, 2007

I created a web statistics application a few years back, it was quite a big application and sometimes needed certain functionality on another server. To request this functionality I would use the PHP require() function to execute the remote file

require("http://www.remoteurl.com/generateStatsSummary.php?accountID=$ID&useDate=2007-11-20");

Then a few days back the main server this application is hosted on got hacked into and had to be rebuilt with new versions of MySQL and PHP installed. The application then decided to stop working, in the end I worked out that the more recent versions of PHP don’t allow you to pass query strings to remote files using the require() or include() functions; you must use file_get_contents() instead!

PHP Function: Email harvester

Thursday, November 8th, 2007

Here is the PHP function I used to collect email addresses from my Outlook express sent items data file. You pass it text and it will return an array of all email addresses that are in the text. Enjoy!

function extract_emails_from($string){
preg_match_all("/[._a-zA-Z0-9-]+@[._a-zA-Z0-9-]+/i", $string, $matches);
return $matches[0];
}

PHP Script: MySQL, database-wide engine modification

Monday, November 5th, 2007

2 large MySQL databases (3 gigabytes worth of data and 2,600 tables) somehow managed to corrupt last week and could not be repaired. It should have been a straight forward task for the outsourced Indian server administrators to restore a backup from a previous day but it wasn't!

In the end they managed to restore a backup of both databases but for some reason they restarted the MySQL server with skip-innodb, so rather than using the desired InnoDB storage engine the databases were restored using the MyISAM storage engine. The application that needs to use this database is a high usage web statistics application that cannot run using MyISAM without 20% of the tables corrupting every other day. So MyISAM just isn't acceptable.

You cannot just issue an alter database command and change the storage engine database-wide, the only option you have is alter table. With 2,600 tables that just isn't practical so I created a PHP script to change the engine type for all tables in a MySQL database. (more...)

Wordpress code highlighter plug-in

Tuesday, October 30th, 2007

Initially I tried to install Dean's code highlighter from the Wordpress plug-in directory but I couldn't get it to work and it didn't seem to highlight my code at all. So instead I installed the other code highlighter that was available. It seemed to work without any problems until I noticed that it was adding a random bit of PHP code </odbc_num_fields($result);++$i)>. (more...)