Archive for August, 2007

Stumbleupon widget for wordpress

Posted by Andy Bailey at 28 August, 2007, 9:05 pm
0

AFAIK this is the first stumbleupon widget for wordpress 2.2 and above!

this post is now here (and so is the widget!)

Stumbleupon Wordpress Widget - Stumbled

Popularity: 1% [?]

Category : Wordpress

Code to redirect surfer from a no ‘www’ address

Posted by Andy Bailey at 28 August, 2007, 6:55 pm
1

This bit of code sends everyone to the same address whatever they used (http://fiddyp.co.uk goes to http://www.fiddyp.co.uk, also redirects .com addresses to the .co.uk one)



if ($_SERVER["HTTP_HOST"] != "www.fiddyp.co.uk") {

  header("Location: http://www.fiddyp.co.uk");

pretty sweet little function, put it in your header and google wont think www.you.com is different from you.com and penalize you for having duplicate content.

Popularity: 1% [?]

Category : Code

Text Between Strings PHP

Posted by Andy Bailey at 28 August, 2007, 6:37 pm
0

here's a useful function that I found in the comments of a php.net function reference to quickly extract the text between two given strings, useful for parsing XML documents or HTML. I've used it to parse lotto results, XML favorites and grabbing <img> links by fopen'ing a HTML file.
$text is the string you want to parse
$s1 is the start string
$s2 is the end string

PHP:
  1. function get_between ($text, $s1, $s2) {
  2. $mid_url = "";
  3. $pos_s = strpos($text,$s1);
  4. $pos_e = strpos($text,$s2);
  5. for ( $i=$pos_s+strlen($s1) ; (( $i<($pos_e)) && $i <strlen($text)) ; $i++ ) {
  6. $mid_url .= $text[$i];
  7. }
  8. return $mid_url;
  9. }

for example if this is a string in the variable $line in a file you are parsing
"<img>http://www.imageurl.com/image.gif</img>"
you can extract the url by using the function like this

PHP:
  1. $imageurl=get_between($line,"<img>","</img>");




Popularity: 2% [?]

Category : Code

Someone stole my face!!

Posted by Andy Bailey at 26 August, 2007, 3:27 pm
7

Thanks to Tristan and Dave Tatley for pointing out an ebay listing that was using my face, some punk calling himself Nathan Felton is passing off my face as his!cheeky git!

The Real Andy Bailey

listing

I've been using this photo on my blog and other promotional items for ages, it's mine!

Popularity: 1% [?]

Category : Blog News

Startdate 260807 … To go in {bold} where many have gone before

Posted by Andy Bailey at 26 August, 2007, 10:46 am
0

Here it is, the new repository for Andy Bailey and all his nerdy, geeky, affiliate, gadget and esoteric things.

Coming soon to the blogosphere (as soon as my other blog completes it's two year mission to use the hell out of it's hosting)

Popularity: 1% [?]

Category : Blog News
13 online now
the most online was 176
elottery magnetic Sponsoring
Sponsors
available ad space available ad space available ad space available ad space available ad space available ad space