Gordonmac Dot Com

Mostly a web development blog

Caithnesian – My new website

Posted: December 21st, 2011 | Posted in: General

I recently completed a new website for myself. How exciting! Over the past three years WordPress has almost become my sole occupation, creating client websites using its feature-rich API and templating system. Creating websites with it has become a pleasure, and with a reasonablly smooth learning curve, most …
Read more…

Validating e-mail addresses in PHP

Posted: November 17th, 2011 | Tags: | Posted in: PHP, Tutorials

This is easily the best function I’ve used for validating e-mail addresses in my PHP scripts and applications. function is_valid_email($email) { $qtext = ‘[^\x0d\x22\x5c\x80-\xff]’; $dtext = ‘[^\x0d\x5b-\x5d\x80-\xff]’; $atom = ‘[^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+’; $quoted_pair = ‘\x5c[\x00-\x7f]’; $domain_literal = “\x5b($dtext|$quoted_pair)*\x5d”; $quoted_string = “\x22($qtext|$quoted_pair)*\x22”; $domain_ref = $atom; $sub_domain = “($domain_ref|$domain_literal)”; $word = “($atom|$quoted_string)”; …
Read more…

Displaying recent posts in the WordPress sidebar

Posted: November 14th, 2011 | Tags: | Posted in: PHP, Tutorials, Wordpress

To add recent posts navigation to your WordPress blog, simple add the following code to sidebar.php. <h2>Recent Posts</h2> <nav id=”navigation-recent”> <ul> <?php $recent_posts = wp_get_recent_posts(5); foreach( $recent_posts as $recent ){ $date = date(“M d, Y”,strtotime($recent[“post_date”])); echo ‘<li><a href=”‘ . get_permalink($recent[“ID”]) . ‘” title=”Look ‘.$recent[“post_title”].'” >’ . $recent[“post_title”].'</a> ‘.$date.'</li>’; …
Read more…

Pacific Outdoor Equipment Peak ELITE AC – 2

Posted: November 8th, 2011 | Posted in: General

After contacting Pacific Outdoor Equipment yesterday, I recieved the following response from their Uk Distributor, Burton McCall‘s Chris Stuckey Dear Gordon I am sorry to hear about the problems the you have had with your sleeping pads. It has become apparent that a faulty batch of pads have …
Read more…