We're growing into something new. Read More
davgothic

David Hancock


New WordPress Theme Design

Hey Forrsters! Thought I would post up my WIP portfolio Wordpress theme. It's took a lot longer than it probably should and I've finally got to a point where I feel happy with it, but I would really appreciate any feedback/critique you could provide. P.S It's the first WordPress theme I've ever actually "designed" so please go easy ;)

Fancy Image Carousel

Just put together a simple and fancy image carousel, let me know what you think. Download the PSD if you like it.

# Make sure mod_rewrite is enabled
RewriteEngine on
 
# Show maintenance page to visitors
RewriteCond %{REMOTE_ADDR} !^111\.111\.111\.111
RewriteCond %{REQUEST_URI} !/maintenance.html$
RewriteRule $ /maintenance.html [R=503,L]

Display a maintenance page during a site upgrade using .htaccess

Simple mod_rewrite rule to redirect all visitors except for hosts you have specified to a maintenance page when performing a site upgrade. Obviously will only work with Apache. Just drop the code into your .htacess file and change the false IP address to match the host you wish to whitelist. If you need to provide access to multiple hosts, just duplicate the line containing the IP as required. Addendum 03/06/2011: Updated the code to redirect using a 503 header as per wturrell's advice. See the following page: 503 service temporarily unavailable

Clean Looking Form Elements

Some clean and simple form elements that I use in my projects from time to time. Please critique!

Discussion

Idiorm & Paris. A minimalist database toolkit for PHP 5.

I stumbled across this site a couple of weeks ago and I have to say I'm super impressed! Idiorm is brilliant for those small projects that just don't need a full blown ORM. The author states it has only been tested with MySQL and SQLite on PHP 5.2.0, but if that's your regular environment and you like what you see, give it a go! I hope others find it as helpful as I have.

/**
 * Recursively deletes a directory
 *
 * @param  string  path to a directory
 * @return void
 */
function delete($path)
{
	$iterator = new RecursiveIteratorIterator(
		new RecursiveDirectoryIterator($path),
		RecursiveIteratorIterator::CHILD_FIRST
	);
 
	foreach ($iterator as $file)
	{
		if ($file->isDir())
		{
			rmdir($file->getPathname());
		}
		elseif ($file->isFile() || $file->isLink())
		{
			unlink($file->getPathname());
		}
	}
 
	rmdir($path);
}

Recursively delete directories using PHP

Just a small function I sometime require to remove a directory and all of its sub directories/files. I believe it will only work on PHP >= 5.1.3 due to the use of SPL (Standard PHP Library). Just pass a valid path as an argument: delete('/path/to/the/directory'); Hope someone finds it useful! I welcome comments, critique and feedback.