Posts Tagged ‘PHP’

Features and characteristics of a great 404 error page

Friday, May 23rd, 2008

No matter how carefully you design your site, visitors will always request a page that is missing, moved, or non-existent (especially if you experiment with your site structure frequently). This past week, I’ve been obsessed with HTTP 404 errors and working on creating a better 404 Not Found page. The default 404 page for WordPress offers the opportunity to search the blog, but you should go another step. Usability is one of (if not the) key trait of a great website. If thought has gone into even your 404 error page, then I’d guess that much thought has been put into your entire site. (more…)

Change media and images to full size in WordPress media gallery

Wednesday, May 21st, 2008

I’ve been familiarizing myself with WordPress 2.5’s new media gallery. If you’ve visited my blog before, you know I don’t upload many images, but I’m hoping to upload many images to my wife, Rachel Steely’s website. I was annoyed to find out that the default image posting size is medium (which is about 300px). On top of that, if you select full size, it doesn’t mean full size. It means your WordPress theme’s column width. So unless you are using Kubrick your media size will not be your column width. (more…)

Plain text link to HTML with a PHP function and regular expressions

Wednesday, May 7th, 2008

If you have ever wanted to turn a plain text link, http://www.smjdesign.com, into a “linked” HTML version, http://www.smjdesign.com, you can know. Pass the following function your entire text field and it will find all your links and return tagged HTML.

function replace_plain_text_link($plain_text) {
$url_html = preg_replace(
'/(?<!S)((http(s?):\/\/)|(www.))+([w.1-9\&=#?-~%;]+)/’, ‘<a href=”http$3://$4$5″>http$3://$4$5</a>’, $plain_text);
return ($url_html);
}
echo replace_plain_text_link(”hi this is dummy text before http://www.smjdesign.com hi this is dummy text after”)

(more…)


Books Now Reading

My Sites