Copy the contents of a directory from one location to another with PHP

I regularly copy contents of a remote directory via a cron job into a local directory so I can work with and manipulate files locally. I have agreements with providers of certain data so I can log into their server and copy reports and content for my own users. There are a number of ways [...]

Use PHP to add Images in Rows

There are countless ways of rendering images to a page in rows. This example pertains to people that store image URL’s into a database. Youl could just as easily read the contents of a directly that contains images of certain types, but that may wait until another time. Using the below example – modified slightly [...]

Print all files from and below a directory with PHP

I had a gentleman ask me on a forum recently how to produce a simple list of all files within and below a particular directory. Here’s some simple PHP code that will simply produce a list of all files below a particular directory and provide a link to that particular file. This code will just [...]

Thesis and the Facebook Like Plugin

like

One of the best ways of promoting your blogs is via Facebook integration. There are a number of ways of achieving this, but I’ve found that the most organic and least intrusive way of promoting a single post is the Facebook like button (not unlike posting a link to your Twitter stream). It isn’t associated [...]

Thesis and Yet Another Featured Posts Plugin (YAFPP)

There are a large number of plugins that simply don’t work with Thesis for one reason or another – particularly widgetised plugins – but that doesn’t mean that you can’t use them. If you don’t know much about the thesis framework (no, it’s not a theme) then you’re likely to be unfamiliar with hooks. If [...]

A problem with the PHP mail function… and alternatives

php-mail

I hate the php mail() function. I’ve had so much trouble with reliability that I’ve pretty much given up on it as a means of sending mail. I now use the SMTP class SwiftMailer almost exclusively with everything I do… and I never thought or bothered to investigated the range of issues that were problematic [...]

PHP Function to Force Links to Open in a New Window

Here’s a very simple PHP function that will parse text and force fully constructed links to open in a new window. If you’re building a comment area (or something similar) for your website it’s likely that you want to retain an open page to minimise your click-through-rate, and this function will assist to serve that [...]

BBcode with PHP

What is BB Code? Bulletin Board Code or BB Code is a lightweight markup language used to format text within posts made on the majority of message board platforms, although it’s now widely used in any application that permits posts, comments or contributions from users. The available BBcode tags (similar to HTML) are usually indicated [...]

Simple WHOIS PHP Script

whois-icon

WHOIS is a protocol that is widely used for querying databases in order to determine the registrant or assignee of a domain name or IP address (range). In its simplest form, building a small PHP script to query the appropriate WHOIS server and outputting readable information is quite simple, yet complex solutions are usually required [...]

Form Checking & Displaying Errors

A friend emailed me tonight and asked how I output form errors onto a page once a user has submitted invalid data. Rather than email him back, I’ll post an abbreviated version of my preferred method here. My friend wrote about 50 lines of code to accomplish what we do in about 10 below. I [...]

Make text links clickable

The process of parsing text and making text links within it clickable is quite challenging, and well beyond the comprehension of my limited brain capacity. Fortunately, there are plenty of people out there who have released their own snippets of code that tend to accomplish the task quite well – particularly if you’re submitting text [...]