I recently saw an image demonstrating What Beautiful HTML Looks Like. I’ve decided to do my own What Beautiful PHP and AJAX Looks Like image. You can also play with the actual application that this image demonstrates if you so wish!

This example makes use of the Prototype JavaScript library. I’m using this, as it simplifies AJAX calls, and keeps this tutorial simple. You can view the full source here, which you can view, copy and include in your AJAX applications. It contains suffice comments which should help you understand how everything works.
Credit for the email validation goes to ILoveJackDaniels. It’s not bullet-proof, but suffice for this example.
Comments would be much appreciated on this blog entry. Positive and constructive only.
Posted in
AJAX,
PHP at November 13th, 2007.
9 Comments.
Have you seen those websites such as Digg and SVP that use fancy URLs such as http://domain.com/page_content? Yeah, sure this could be nearly achieved by simply renaming your pages to something like page_content.htm – but that would result in you having to change every page on your site to a suitably written filename, as well as relying on static pages. I’m going to attempt to demonstrate just how easy it really is to utilise mod_rewrite to have fancy – even “web 2.0″ – URLs within your site.
Read More…
Posted in
.htaccess,
Apache at November 7th, 2007.
40 Comments.
Ok, so how do you load a .php file into your web browser, and what does it do when you type (for example) http://www.edrackham.com/index.php then hit enter?
- The web browser requests the document with the .php extension from the edrackham.com server.
- The webserver kicks in and says “Hey! Someone wants a PHP file. Something else needs to deal with it because I only serve HTML”, and then sends the request onto a PHP parser software located on the server.
- The PHP parser finds the PHP file, then scans it for PHP code from top to bottom, left to right (how we read … that is if you’re English).
- When the PHP parser finds PHP code, it executes it and places the output (if any) into the place in the file formerly occupied by the code.
- This new output is sent back to the webserver.
- The webserver then sends it along to the web browser.
- The web browser displays the output.
Read More…
Posted in
PHP at November 5th, 2007.
1 Comment.
This is a simple snippet of code that will return an array of days between two dates.
Read on for a little more info…
Read More…
Posted in
PHP at November 1st, 2007.
26 Comments.
Ok, so how do you format dates in PHP so it outputs the date format you want? Well thanks to PHP’s date() and strtotime() function, we can do all that! To kick off, lets take the most common date format ‘YYYY-MM-DD HH:II:SS‘. This date format seems to be most favoured as it increments in such a way that allows you to query a database that has multiple records in a useful way, such as:
SELECT * FROM dates WHERE date > '2006-03-05 11:00:00';
Read More…
Posted in
PHP at November 1st, 2007.
No Comments.