<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Matthew Byrne: the blog &#187; Wordpress</title>
	<atom:link href="http://www.matthewbyrne.co.uk/tag/wordpress/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.matthewbyrne.co.uk</link>
	<description>copywriter / producer / blogger</description>
	<lastBuildDate>Sun, 03 May 2009 20:06:26 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>WordPress &#8211; Redirecting to old domain</title>
		<link>http://www.matthewbyrne.co.uk/projects/wordpress-redirecting-to-old-domain/</link>
		<comments>http://www.matthewbyrne.co.uk/projects/wordpress-redirecting-to-old-domain/#comments</comments>
		<pubDate>Tue, 27 Jan 2009 15:39:03 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[projects]]></category>
		<category><![CDATA[PHP MyAdmin]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://www.matthewbyrne.co.uk/?p=176</guid>
		<description><![CDATA[After migrating a WordPress site to a new domain (renaming the root folder) I found that my new site kept forwarding to the development domain. As I was unable get into the admin screen of WordPress to change the base URL of the site I had to alter it directly in the database. The path [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.matthewbyrne.co.uk/wp-content/uploads/2009/02/wp_redirect2.jpg" alt="" title="wp_redirect2" width="500" height="114" class="alignnone size-full wp-image-181" /></p>
<p>After migrating a WordPress site to a new domain (renaming the root folder) I found that my new site kept forwarding to the development domain. As I was unable get into the admin screen of WordPress to change the base URL of the site I had to alter it directly in the database.</p>
<p>The path to the base URL of the site is:</p>
<p><b>Server: yourServer.com > Database: Database_name > Table: wp_options</b></p>
<p>In the options table you&#8217;ll find a value named &#8216;URL&#8217;, change this to the new domain name and you should be good to go. </p>
<!-- Social Bookmarking Reloaded BEGIN --><div class="social_bookmark"><em> </em><br /><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http://www.matthewbyrne.co.uk/projects/wordpress-redirecting-to-old-domain/&amp;title=WordPress+%26%238211%3B+Redirecting+to+old+domain" title="Add 'WordPress &#8211; Redirecting to old domain' to Del.icio.us"><img src="http://www.matthewbyrne.co.uk/wp-content/plugins/social-bookmarking-reloaded/delicious.png" title="Add 'WordPress &#8211; Redirecting to old domain' to Del.icio.us" alt="Add 'WordPress &#8211; Redirecting to old domain' to Del.icio.us" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http://www.matthewbyrne.co.uk/projects/wordpress-redirecting-to-old-domain/&amp;title=WordPress+%26%238211%3B+Redirecting+to+old+domain" title="Add 'WordPress &#8211; Redirecting to old domain' to digg"><img src="http://www.matthewbyrne.co.uk/wp-content/plugins/social-bookmarking-reloaded/digg.png" title="Add 'WordPress &#8211; Redirecting to old domain' to digg" alt="Add 'WordPress &#8211; Redirecting to old domain' to digg" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://furl.net/storeIt.jsp?t=WordPress+%26%238211%3B+Redirecting+to+old+domain&amp;u=http://www.matthewbyrne.co.uk/projects/wordpress-redirecting-to-old-domain/" title="Add 'WordPress &#8211; Redirecting to old domain' to FURL"><img src="http://www.matthewbyrne.co.uk/wp-content/plugins/social-bookmarking-reloaded/furl.png" title="Add 'WordPress &#8211; Redirecting to old domain' to FURL" alt="Add 'WordPress &#8211; Redirecting to old domain' to FURL" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://reddit.com/submit?url=http://www.matthewbyrne.co.uk/projects/wordpress-redirecting-to-old-domain/&amp;title=WordPress+%26%238211%3B+Redirecting+to+old+domain" title="Add 'WordPress &#8211; Redirecting to old domain' to reddit"><img src="http://www.matthewbyrne.co.uk/wp-content/plugins/social-bookmarking-reloaded/reddit.png" title="Add 'WordPress &#8211; Redirecting to old domain' to reddit" alt="Add 'WordPress &#8211; Redirecting to old domain' to reddit" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http://www.matthewbyrne.co.uk/projects/wordpress-redirecting-to-old-domain/" title="Add 'WordPress &#8211; Redirecting to old domain' to Technorati"><img src="http://www.matthewbyrne.co.uk/wp-content/plugins/social-bookmarking-reloaded/technorati.png" title="Add 'WordPress &#8211; Redirecting to old domain' to Technorati" alt="Add 'WordPress &#8211; Redirecting to old domain' to Technorati" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.newsvine.com/_wine/save?u=http://www.matthewbyrne.co.uk/projects/wordpress-redirecting-to-old-domain/&amp;h=WordPress+%26%238211%3B+Redirecting+to+old+domain" title="Add 'WordPress &#8211; Redirecting to old domain' to Newsvine"><img src="http://www.matthewbyrne.co.uk/wp-content/plugins/social-bookmarking-reloaded/newsvine.png" title="Add 'WordPress &#8211; Redirecting to old domain' to Newsvine" alt="Add 'WordPress &#8211; Redirecting to old domain' to Newsvine" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://ma.gnolia.com/bookmarklet/add?url=http://www.matthewbyrne.co.uk/projects/wordpress-redirecting-to-old-domain/&amp;title=WordPress+%26%238211%3B+Redirecting+to+old+domain&amp;description=WordPress+%26%238211%3B+Redirecting+to+old+domain" title="Add 'WordPress &#8211; Redirecting to old domain' to Ma.gnolia"><img src="http://www.matthewbyrne.co.uk/wp-content/plugins/social-bookmarking-reloaded/magnolia.png" title="Add 'WordPress &#8211; Redirecting to old domain' to Ma.gnolia" alt="Add 'WordPress &#8211; Redirecting to old domain' to Ma.gnolia" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit?url=http://www.matthewbyrne.co.uk/projects/wordpress-redirecting-to-old-domain/&amp;title=WordPress+%26%238211%3B+Redirecting+to+old+domain" title="Add 'WordPress &#8211; Redirecting to old domain' to Stumble Upon"><img src="http://www.matthewbyrne.co.uk/wp-content/plugins/social-bookmarking-reloaded/stumbleupon.png" title="Add 'WordPress &#8211; Redirecting to old domain' to Stumble Upon" alt="Add 'WordPress &#8211; Redirecting to old domain' to Stumble Upon" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/share.php?u=http://www.matthewbyrne.co.uk/projects/wordpress-redirecting-to-old-domain/&amp;t=WordPress+%26%238211%3B+Redirecting+to+old+domain" title="Add 'WordPress &#8211; Redirecting to old domain' to FaceBook"><img src="http://www.matthewbyrne.co.uk/wp-content/plugins/social-bookmarking-reloaded/facebook.png" title="Add 'WordPress &#8211; Redirecting to old domain' to FaceBook" alt="Add 'WordPress &#8211; Redirecting to old domain' to FaceBook" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://twitter.com/home?status=http://www.matthewbyrne.co.uk/projects/wordpress-redirecting-to-old-domain/" title="Add 'WordPress &#8211; Redirecting to old domain' to Twitter"><img src="http://www.matthewbyrne.co.uk/wp-content/plugins/social-bookmarking-reloaded/twitter.png" title="Add 'WordPress &#8211; Redirecting to old domain' to Twitter" alt="Add 'WordPress &#8211; Redirecting to old domain' to Twitter" /></a></div>
<!-- Social Bookmarking Reloaded END -->]]></content:encoded>
			<wfw:commentRss>http://www.matthewbyrne.co.uk/projects/wordpress-redirecting-to-old-domain/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Form breaks WordPress</title>
		<link>http://www.matthewbyrne.co.uk/projects/form-breaks-wordpress/</link>
		<comments>http://www.matthewbyrne.co.uk/projects/form-breaks-wordpress/#comments</comments>
		<pubDate>Mon, 26 Jan 2009 19:26:18 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[projects]]></category>
		<category><![CDATA[form]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://www.matthewbyrne.co.uk/?p=166</guid>
		<description><![CDATA[Just spent the last hour trying to figure out why a simple php form was breaking WordPress. The answer was a variable name clash. I used a variable called &#8216;name&#8217; in my form which seems to be linked the WP tag tags (!). To get things working I renamed &#8216;name&#8217; to &#8216;signUpName&#8217;. Whilst scrabbling around [...]]]></description>
			<content:encoded><![CDATA[<p><img class="size-full wp-image-165" title="name" src="http://www.matthewbyrne.co.uk/wp-content/uploads/2009/01/name.png" alt="WordPress Variable Clash" width="500" height="193" /></p>
<p>Just spent the last hour trying to figure out why a simple php form was breaking WordPress. The answer was a variable name clash. I used a variable called &#8216;name&#8217; in my form which seems to be linked the WP tag tags (!).</p>
<p>To get things working I renamed &#8216;name&#8217; to &#8216;signUpName&#8217;.</p>
<p>Whilst scrabbling around for answers I did come across a good article about a <a href="http://www.mc2design.com/blog/php_self-safe-alternatives">security vulnerability when using the PHP_Self command</a>, it&#8217;s well worth a read before you build your next form.</p>
<!-- Social Bookmarking Reloaded BEGIN --><div class="social_bookmark"><em> </em><br /><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http://www.matthewbyrne.co.uk/projects/form-breaks-wordpress/&amp;title=Form+breaks+WordPress" title="Add 'Form breaks WordPress' to Del.icio.us"><img src="http://www.matthewbyrne.co.uk/wp-content/plugins/social-bookmarking-reloaded/delicious.png" title="Add 'Form breaks WordPress' to Del.icio.us" alt="Add 'Form breaks WordPress' to Del.icio.us" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http://www.matthewbyrne.co.uk/projects/form-breaks-wordpress/&amp;title=Form+breaks+WordPress" title="Add 'Form breaks WordPress' to digg"><img src="http://www.matthewbyrne.co.uk/wp-content/plugins/social-bookmarking-reloaded/digg.png" title="Add 'Form breaks WordPress' to digg" alt="Add 'Form breaks WordPress' to digg" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://furl.net/storeIt.jsp?t=Form+breaks+WordPress&amp;u=http://www.matthewbyrne.co.uk/projects/form-breaks-wordpress/" title="Add 'Form breaks WordPress' to FURL"><img src="http://www.matthewbyrne.co.uk/wp-content/plugins/social-bookmarking-reloaded/furl.png" title="Add 'Form breaks WordPress' to FURL" alt="Add 'Form breaks WordPress' to FURL" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://reddit.com/submit?url=http://www.matthewbyrne.co.uk/projects/form-breaks-wordpress/&amp;title=Form+breaks+WordPress" title="Add 'Form breaks WordPress' to reddit"><img src="http://www.matthewbyrne.co.uk/wp-content/plugins/social-bookmarking-reloaded/reddit.png" title="Add 'Form breaks WordPress' to reddit" alt="Add 'Form breaks WordPress' to reddit" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http://www.matthewbyrne.co.uk/projects/form-breaks-wordpress/" title="Add 'Form breaks WordPress' to Technorati"><img src="http://www.matthewbyrne.co.uk/wp-content/plugins/social-bookmarking-reloaded/technorati.png" title="Add 'Form breaks WordPress' to Technorati" alt="Add 'Form breaks WordPress' to Technorati" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.newsvine.com/_wine/save?u=http://www.matthewbyrne.co.uk/projects/form-breaks-wordpress/&amp;h=Form+breaks+WordPress" title="Add 'Form breaks WordPress' to Newsvine"><img src="http://www.matthewbyrne.co.uk/wp-content/plugins/social-bookmarking-reloaded/newsvine.png" title="Add 'Form breaks WordPress' to Newsvine" alt="Add 'Form breaks WordPress' to Newsvine" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://ma.gnolia.com/bookmarklet/add?url=http://www.matthewbyrne.co.uk/projects/form-breaks-wordpress/&amp;title=Form+breaks+WordPress&amp;description=Form+breaks+WordPress" title="Add 'Form breaks WordPress' to Ma.gnolia"><img src="http://www.matthewbyrne.co.uk/wp-content/plugins/social-bookmarking-reloaded/magnolia.png" title="Add 'Form breaks WordPress' to Ma.gnolia" alt="Add 'Form breaks WordPress' to Ma.gnolia" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit?url=http://www.matthewbyrne.co.uk/projects/form-breaks-wordpress/&amp;title=Form+breaks+WordPress" title="Add 'Form breaks WordPress' to Stumble Upon"><img src="http://www.matthewbyrne.co.uk/wp-content/plugins/social-bookmarking-reloaded/stumbleupon.png" title="Add 'Form breaks WordPress' to Stumble Upon" alt="Add 'Form breaks WordPress' to Stumble Upon" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/share.php?u=http://www.matthewbyrne.co.uk/projects/form-breaks-wordpress/&amp;t=Form+breaks+WordPress" title="Add 'Form breaks WordPress' to FaceBook"><img src="http://www.matthewbyrne.co.uk/wp-content/plugins/social-bookmarking-reloaded/facebook.png" title="Add 'Form breaks WordPress' to FaceBook" alt="Add 'Form breaks WordPress' to FaceBook" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://twitter.com/home?status=http://www.matthewbyrne.co.uk/projects/form-breaks-wordpress/" title="Add 'Form breaks WordPress' to Twitter"><img src="http://www.matthewbyrne.co.uk/wp-content/plugins/social-bookmarking-reloaded/twitter.png" title="Add 'Form breaks WordPress' to Twitter" alt="Add 'Form breaks WordPress' to Twitter" /></a></div>
<!-- Social Bookmarking Reloaded END -->]]></content:encoded>
			<wfw:commentRss>http://www.matthewbyrne.co.uk/projects/form-breaks-wordpress/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Postcode Widget &#8211; Part 3</title>
		<link>http://www.matthewbyrne.co.uk/projects/postcode-widget-part-3/</link>
		<comments>http://www.matthewbyrne.co.uk/projects/postcode-widget-part-3/#comments</comments>
		<pubDate>Mon, 25 Aug 2008 10:59:38 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[projects]]></category>
		<category><![CDATA[Google map]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[Postcode]]></category>
		<category><![CDATA[Regex]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://www.matthewbyrne.co.uk/?p=77</guid>
		<description><![CDATA[You can see a prototype version of the widget by clicking here. Template engine I attempted this built as single piece of php but it quickly became obvious that this was not the right approach. Instead I adapted a simple template engine from my faithful O&#8217;Reilly book. This allowed me to separate the logic from [...]]]></description>
			<content:encoded><![CDATA[<p>You can see a prototype version of the widget by <a title="a working prototype of the widget" href="http://www.matthewbyrne.co.uk/postCodeWidget.php">clicking here</a>.</p>
<h3>Template engine</h3>
<p>I attempted this built as single piece of php but it quickly became obvious that this was not the right approach. Instead I adapted a simple template engine from my faithful <a href="http://oreilly.com/catalog/9781565926103/">O&#8217;Reilly book</a>. This allowed me to separate the logic from the markup</p>
<pre>function FillTemplate($inName, $inValues = array()){

	$theTemplateFile = $_SERVER['DOCUMENT_ROOT'].'/templates/'.$inName;
	if($theFile = fopen($theTemplateFile, 'r')){
		$theTemplate = fread($theFile, filesize($theTemplateFile));
		fclose($theFile);
	}
	$theKeys = array_keys($inValues);
	foreach($theKeys as $theKey){
		$theTemplate = str_replace("\{$theKey}",$inValues[$theKey],$theTemplate);
	}

	return $theTemplate;
}</pre>
<h3>Map Logic</h3>
<p>Here&#8217;s the source for the Map Logic. As an attempt to make the script secure you can see I&#8217;ve used a <a title="Postcode Regex author" href="http://regexlib.com/UserPatterns.aspx?authorId=97d6e0fb-0c53-4cfd-94f8-bf3afd2407e5">UK Postcode Regex from Stuart Wade</a> to validate the form input. And also <strong>mysql_real_escape_string()</strong> on any database calls.</p>
<p>Any security tips would be greatly appreciated</p>
<p>The Map Logic uses four separate templates to handle the interaction, and the error state.</p>
<pre>&lt;?php
//Pin counter
connectDB();
$result = mysql_query("SELECT * FROM mapPins");
$num_rows = mysql_num_rows($result);
$bindings['PINCOUNT'] = $num_rows;

//Place Pins
$pinQuery = "SELECT Latitude,Longitude FROM mapPins";
$pinArray = mysql_query($pinQuery)or die('Query failed: '.mysql_error());
$pinCode="";
while ($row = mysql_fetch_array($pinArray, MYSQL_NUM)) {;
	$i++;
	$pinCode .="var latlng$i = new GLatLng($row[0] ,$row[1] );";
	$pinCode .="map.addOverlay(new GMarker(latlng$i));";
}
$bindings['MAPPINS'] = $pinCode;

$bindings['DESTINATION'] = $PHP_SELF;

function centerFromDB($postcode){
	//Connect to the database
	connectDB();
	//Convert the Postcode to all uppercase
	$postcode = strtoupper($postcode);

	//Break the Postcode into array
	$postcode = explode(' ', $postcode);

	//Pull out the relevant fields from our database
	$query = "SELECT Latitude,Longitude FROM postcodes WHERE Pcode= '$postcode[0]'";
	$result = mysql_query($query) or die('Query failed: '.mysql_error());
	return mysql_fetch_array($result, MYSQL_ASSOC);

}

if (isset($_POST['submitPostCode']) &amp; $_POST['code']!="") {
	if(eregi("^([A-PR-UWYZ0-9][A-HK-Y0-9][AEHMNPRTVXY0-9]?[ABEHMNPRVWXY0-9]? {1,2}[0-9][ABD-HJLN-UW-Z]{2}|GIR 0AA)$",mysql_real_escape_string($_POST['code']))){
		$line = centerFromDB(mysql_real_escape_string($_POST['code']));

		//Grab the Postcode from the form
		$postcode = mysql_real_escape_string($_POST['code']);

		//Uppercase
		$postcode = strtoupper($postcode);

		//Break the Postcode into array
		$postcode = explode(' ', $postcode);

		//Output Results
		$bindings['INITIALCENTER'] = "var center = new GLatLng(".$line['Latitude'].", ".$line['Longitude'].");";
		$bindings['OUTCODE'] = $postcode[0];
		$bindings['SECONDHALF'] = $postcode[1];

		$template = "map02.template";
	}else{

		$template = "mapError.template";
	}
}elseif(isset($_POST['plotPoints'])){

	$outCode = mysql_real_escape_string($_GET['outCode']);
	$secondHalf = mysql_real_escape_string($_GET['secondHalf']);
	$mapLat = mysql_real_escape_string($_GET['mapLat']);
	$mapLng = mysql_real_escape_string($_GET['mapLng']);
	$today = date("Y-m-d");

	$line = centerFromDB($outCode.' '.$secondHalf);
	//connect to db
	connectDB();

	//add point to db
	mysql_query("INSERT INTO mapPins (outCode, secondHalf, Latitude, Longitude, theDate) VALUES('$outCode', '$secondHalf', '$mapLat', '$mapLng', '$today') ") or die(mysql_error()); 

	$pinQuery = "SELECT Latitude,Longitude FROM mapPins WHERE outCode='$outCode' AND secondHalf='$secondHalf'";
	$pinArray = mysql_query($pinQuery)or die('Query failed: '.mysql_error());

	$pinCode="";
	while ($row = mysql_fetch_array($pinArray, MYSQL_NUM)) {;
		$i++;
		$pinCode .="var latlng$i = new GLatLng($row[0] ,$row[1] );";
		$pinCode .="map.addOverlay(new GMarker(latlng$i));";
	}
	//new
	$bindings['CURRENTPC'] = $outCode.' '.$secondHalf;
	$bindings['MAPPINS'] = $pinCode;
	$bindings['NEWCENTER'] = "var center = new GLatLng(".$line['Latitude'].", ".$line['Longitude'].");";

	$template = "map03.template";
}else{

	$template = "map01.template";

}

echo FillTemplate($template, $bindings);
?&gt;</pre>
<h3>Integrating script with WordPress</h3>
<p>After developing this script I discovered that WordPress can&#8217;t run PHP in the body of a post without a plugin. Strange. So I had to put the prototype on a loose page.</p>
<p>Take a look at the trick I used to capture the output of a WordPress tag so I could incorporate it into Map Logic, and then my templates. In this example I captured the footer code, then bound it to a template tag.</p>
<pre>&lt;?php
require('./wp-blog-header.php');
ob_start();
get_footer();
$footer = ob_get_contents();
ob_end_clean();
$bindings['FOOTER'] = $footer;
?&gt;</pre>
<!-- Social Bookmarking Reloaded BEGIN --><div class="social_bookmark"><em> </em><br /><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http://www.matthewbyrne.co.uk/projects/postcode-widget-part-3/&amp;title=Postcode+Widget+%26%238211%3B+Part+3" title="Add 'Postcode Widget &#8211; Part 3' to Del.icio.us"><img src="http://www.matthewbyrne.co.uk/wp-content/plugins/social-bookmarking-reloaded/delicious.png" title="Add 'Postcode Widget &#8211; Part 3' to Del.icio.us" alt="Add 'Postcode Widget &#8211; Part 3' to Del.icio.us" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http://www.matthewbyrne.co.uk/projects/postcode-widget-part-3/&amp;title=Postcode+Widget+%26%238211%3B+Part+3" title="Add 'Postcode Widget &#8211; Part 3' to digg"><img src="http://www.matthewbyrne.co.uk/wp-content/plugins/social-bookmarking-reloaded/digg.png" title="Add 'Postcode Widget &#8211; Part 3' to digg" alt="Add 'Postcode Widget &#8211; Part 3' to digg" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://furl.net/storeIt.jsp?t=Postcode+Widget+%26%238211%3B+Part+3&amp;u=http://www.matthewbyrne.co.uk/projects/postcode-widget-part-3/" title="Add 'Postcode Widget &#8211; Part 3' to FURL"><img src="http://www.matthewbyrne.co.uk/wp-content/plugins/social-bookmarking-reloaded/furl.png" title="Add 'Postcode Widget &#8211; Part 3' to FURL" alt="Add 'Postcode Widget &#8211; Part 3' to FURL" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://reddit.com/submit?url=http://www.matthewbyrne.co.uk/projects/postcode-widget-part-3/&amp;title=Postcode+Widget+%26%238211%3B+Part+3" title="Add 'Postcode Widget &#8211; Part 3' to reddit"><img src="http://www.matthewbyrne.co.uk/wp-content/plugins/social-bookmarking-reloaded/reddit.png" title="Add 'Postcode Widget &#8211; Part 3' to reddit" alt="Add 'Postcode Widget &#8211; Part 3' to reddit" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http://www.matthewbyrne.co.uk/projects/postcode-widget-part-3/" title="Add 'Postcode Widget &#8211; Part 3' to Technorati"><img src="http://www.matthewbyrne.co.uk/wp-content/plugins/social-bookmarking-reloaded/technorati.png" title="Add 'Postcode Widget &#8211; Part 3' to Technorati" alt="Add 'Postcode Widget &#8211; Part 3' to Technorati" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.newsvine.com/_wine/save?u=http://www.matthewbyrne.co.uk/projects/postcode-widget-part-3/&amp;h=Postcode+Widget+%26%238211%3B+Part+3" title="Add 'Postcode Widget &#8211; Part 3' to Newsvine"><img src="http://www.matthewbyrne.co.uk/wp-content/plugins/social-bookmarking-reloaded/newsvine.png" title="Add 'Postcode Widget &#8211; Part 3' to Newsvine" alt="Add 'Postcode Widget &#8211; Part 3' to Newsvine" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://ma.gnolia.com/bookmarklet/add?url=http://www.matthewbyrne.co.uk/projects/postcode-widget-part-3/&amp;title=Postcode+Widget+%26%238211%3B+Part+3&amp;description=Postcode+Widget+%26%238211%3B+Part+3" title="Add 'Postcode Widget &#8211; Part 3' to Ma.gnolia"><img src="http://www.matthewbyrne.co.uk/wp-content/plugins/social-bookmarking-reloaded/magnolia.png" title="Add 'Postcode Widget &#8211; Part 3' to Ma.gnolia" alt="Add 'Postcode Widget &#8211; Part 3' to Ma.gnolia" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit?url=http://www.matthewbyrne.co.uk/projects/postcode-widget-part-3/&amp;title=Postcode+Widget+%26%238211%3B+Part+3" title="Add 'Postcode Widget &#8211; Part 3' to Stumble Upon"><img src="http://www.matthewbyrne.co.uk/wp-content/plugins/social-bookmarking-reloaded/stumbleupon.png" title="Add 'Postcode Widget &#8211; Part 3' to Stumble Upon" alt="Add 'Postcode Widget &#8211; Part 3' to Stumble Upon" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/share.php?u=http://www.matthewbyrne.co.uk/projects/postcode-widget-part-3/&amp;t=Postcode+Widget+%26%238211%3B+Part+3" title="Add 'Postcode Widget &#8211; Part 3' to FaceBook"><img src="http://www.matthewbyrne.co.uk/wp-content/plugins/social-bookmarking-reloaded/facebook.png" title="Add 'Postcode Widget &#8211; Part 3' to FaceBook" alt="Add 'Postcode Widget &#8211; Part 3' to FaceBook" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://twitter.com/home?status=http://www.matthewbyrne.co.uk/projects/postcode-widget-part-3/" title="Add 'Postcode Widget &#8211; Part 3' to Twitter"><img src="http://www.matthewbyrne.co.uk/wp-content/plugins/social-bookmarking-reloaded/twitter.png" title="Add 'Postcode Widget &#8211; Part 3' to Twitter" alt="Add 'Postcode Widget &#8211; Part 3' to Twitter" /></a></div>
<!-- Social Bookmarking Reloaded END -->]]></content:encoded>
			<wfw:commentRss>http://www.matthewbyrne.co.uk/projects/postcode-widget-part-3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The SEO experiment &#8211; Part 1 groundwork</title>
		<link>http://www.matthewbyrne.co.uk/seo/the-seo-experiment-part-1-groundwork/</link>
		<comments>http://www.matthewbyrne.co.uk/seo/the-seo-experiment-part-1-groundwork/#comments</comments>
		<pubDate>Sun, 10 Aug 2008 22:45:03 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[SEO]]></category>
		<category><![CDATA[Analytics]]></category>
		<category><![CDATA[FileZilla]]></category>
		<category><![CDATA[ftp]]></category>
		<category><![CDATA[Google]]></category>
		<category><![CDATA[Google Page Rank]]></category>
		<category><![CDATA[Webmaster tools]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://www.matthewbyrne.co.uk/?p=40</guid>
		<description><![CDATA[I&#8217;ll admit it, I&#8217;m very drawn towards Search Engine Optimization (SEO). The idea that you can drastically improve the visibility of your site with a few code and content tweaks certainly does appeal to my lazy bone. For my experiment this site is currently the perfect candidate; low traffic, and scoring exactly zero in Googles [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ll admit it, I&#8217;m very drawn towards Search Engine Optimization (SEO). The idea that you can drastically improve the visibility of your site with a few code and content tweaks certainly does appeal to my lazy bone. </p>
<p>For my experiment this site is currently the perfect candidate; low traffic, and scoring exactly zero in Googles Page Ranking.</p>
<p>However, that&#8217;s all about to change.</p>
<p>There are a number of techniques involved in SEO which I&#8217;ll cover as I go along.</p>
<p>Okay, first things first; get a Google account. Done that already? Great!</p>
<p>Now what&#8217;s needed here is the Webmaster Tools and Analytics. These will show how Google sees this site, help uncover any errors, and measure progress.</p>
<p>Before going any further decide on the url, in my case either:<br />
&#8216;http://matthewbyrne.co.uk&#8217;<br />
or<br />
&#8216;http://www.matthewbyrne.co.uk&#8217; &#8211; my choice</p>
<p>Whatever you choose, stick with it.</p>
<h3>Setting up Google Webmaster tools</h3>
<ol>
<li>Enter the URL of your site</li>
<li> Click &#8216;Verify your site&#8217;</li>
<li> Select a verification method &#8211; Here I always choose to upload an html file</li>
<li> Make a blank text file on your desktop, and rename it to your unique file name google5b27wb292f65b6.html</li>
<li> Upload this to your sites root directory using your favourite ftp program &#8211; I use FileZilla</li>
<li> Hit verify</li>
</ol>
<h3>Add a sitemap to Google Webmaster tools</h3>
<p>If you&#8217;re site is built with WordPress, download and install the excellent &#8216;<a href="http://www.arnebrachhold.de/projects/wordpress-plugins/google-xml-sitemaps-generator/">Google XML Sitemaps Generator for WordPress</a>&#8216; plug-in. This automatically generates a fresh sitemap each time you add new content taking all the donkey work out of the job. Whilst you&#8217;re on their site why not donate a couple of dollars to encourage great software?</p>
<ol>
<li>For everybody else <a href="http://www.xml-sitemaps.com/">visit XML-Sitemaps.com to  build a  sitemap</a>.</li>
<li> Enter your URL</li>
<li> Hit &#8216;Generate&#8217;</li>
<li> Download the file to your desktop</li>
<li> Upload it to your site root with your ftp client</li>
<li>Back in the Webmaster tools hit Sitemap &gt; &#8216;Add a sitemap&#8217;</li>
<li>Fill in the sitemap name &#8216;sitemap.xml&#8217;</li>
<li>Hit &#8216;Add general web sitemap&#8217; and you&#8217;re done</li>
</ol>
<p>Now I hop over to the Google account page and select Analytics.</p>
<h3>Set up Google Analytics</h3>
<ol>
<li>Hit &#8216;Add new website profile&#8217;</li>
<li> Enter your URL</li>
<li> Hit &#8216;Finish&#8217;</li>
<li> Copy the chunk of code into all your pages before the closing body tag and you&#8217;re done</li>
</ol>
<p>I&#8217;ll take a few hours/days for Google to process this information, and longer to give you anything meaningful, so don&#8217;t hold your breath. Next, determine the Google Page Rank.</p>
<!-- Social Bookmarking Reloaded BEGIN --><div class="social_bookmark"><em> </em><br /><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http://www.matthewbyrne.co.uk/seo/the-seo-experiment-part-1-groundwork/&amp;title=The+SEO+experiment+%26%238211%3B+Part+1+groundwork" title="Add 'The SEO experiment &#8211; Part 1 groundwork' to Del.icio.us"><img src="http://www.matthewbyrne.co.uk/wp-content/plugins/social-bookmarking-reloaded/delicious.png" title="Add 'The SEO experiment &#8211; Part 1 groundwork' to Del.icio.us" alt="Add 'The SEO experiment &#8211; Part 1 groundwork' to Del.icio.us" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http://www.matthewbyrne.co.uk/seo/the-seo-experiment-part-1-groundwork/&amp;title=The+SEO+experiment+%26%238211%3B+Part+1+groundwork" title="Add 'The SEO experiment &#8211; Part 1 groundwork' to digg"><img src="http://www.matthewbyrne.co.uk/wp-content/plugins/social-bookmarking-reloaded/digg.png" title="Add 'The SEO experiment &#8211; Part 1 groundwork' to digg" alt="Add 'The SEO experiment &#8211; Part 1 groundwork' to digg" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://furl.net/storeIt.jsp?t=The+SEO+experiment+%26%238211%3B+Part+1+groundwork&amp;u=http://www.matthewbyrne.co.uk/seo/the-seo-experiment-part-1-groundwork/" title="Add 'The SEO experiment &#8211; Part 1 groundwork' to FURL"><img src="http://www.matthewbyrne.co.uk/wp-content/plugins/social-bookmarking-reloaded/furl.png" title="Add 'The SEO experiment &#8211; Part 1 groundwork' to FURL" alt="Add 'The SEO experiment &#8211; Part 1 groundwork' to FURL" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://reddit.com/submit?url=http://www.matthewbyrne.co.uk/seo/the-seo-experiment-part-1-groundwork/&amp;title=The+SEO+experiment+%26%238211%3B+Part+1+groundwork" title="Add 'The SEO experiment &#8211; Part 1 groundwork' to reddit"><img src="http://www.matthewbyrne.co.uk/wp-content/plugins/social-bookmarking-reloaded/reddit.png" title="Add 'The SEO experiment &#8211; Part 1 groundwork' to reddit" alt="Add 'The SEO experiment &#8211; Part 1 groundwork' to reddit" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http://www.matthewbyrne.co.uk/seo/the-seo-experiment-part-1-groundwork/" title="Add 'The SEO experiment &#8211; Part 1 groundwork' to Technorati"><img src="http://www.matthewbyrne.co.uk/wp-content/plugins/social-bookmarking-reloaded/technorati.png" title="Add 'The SEO experiment &#8211; Part 1 groundwork' to Technorati" alt="Add 'The SEO experiment &#8211; Part 1 groundwork' to Technorati" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.newsvine.com/_wine/save?u=http://www.matthewbyrne.co.uk/seo/the-seo-experiment-part-1-groundwork/&amp;h=The+SEO+experiment+%26%238211%3B+Part+1+groundwork" title="Add 'The SEO experiment &#8211; Part 1 groundwork' to Newsvine"><img src="http://www.matthewbyrne.co.uk/wp-content/plugins/social-bookmarking-reloaded/newsvine.png" title="Add 'The SEO experiment &#8211; Part 1 groundwork' to Newsvine" alt="Add 'The SEO experiment &#8211; Part 1 groundwork' to Newsvine" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://ma.gnolia.com/bookmarklet/add?url=http://www.matthewbyrne.co.uk/seo/the-seo-experiment-part-1-groundwork/&amp;title=The+SEO+experiment+%26%238211%3B+Part+1+groundwork&amp;description=The+SEO+experiment+%26%238211%3B+Part+1+groundwork" title="Add 'The SEO experiment &#8211; Part 1 groundwork' to Ma.gnolia"><img src="http://www.matthewbyrne.co.uk/wp-content/plugins/social-bookmarking-reloaded/magnolia.png" title="Add 'The SEO experiment &#8211; Part 1 groundwork' to Ma.gnolia" alt="Add 'The SEO experiment &#8211; Part 1 groundwork' to Ma.gnolia" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit?url=http://www.matthewbyrne.co.uk/seo/the-seo-experiment-part-1-groundwork/&amp;title=The+SEO+experiment+%26%238211%3B+Part+1+groundwork" title="Add 'The SEO experiment &#8211; Part 1 groundwork' to Stumble Upon"><img src="http://www.matthewbyrne.co.uk/wp-content/plugins/social-bookmarking-reloaded/stumbleupon.png" title="Add 'The SEO experiment &#8211; Part 1 groundwork' to Stumble Upon" alt="Add 'The SEO experiment &#8211; Part 1 groundwork' to Stumble Upon" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/share.php?u=http://www.matthewbyrne.co.uk/seo/the-seo-experiment-part-1-groundwork/&amp;t=The+SEO+experiment+%26%238211%3B+Part+1+groundwork" title="Add 'The SEO experiment &#8211; Part 1 groundwork' to FaceBook"><img src="http://www.matthewbyrne.co.uk/wp-content/plugins/social-bookmarking-reloaded/facebook.png" title="Add 'The SEO experiment &#8211; Part 1 groundwork' to FaceBook" alt="Add 'The SEO experiment &#8211; Part 1 groundwork' to FaceBook" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://twitter.com/home?status=http://www.matthewbyrne.co.uk/seo/the-seo-experiment-part-1-groundwork/" title="Add 'The SEO experiment &#8211; Part 1 groundwork' to Twitter"><img src="http://www.matthewbyrne.co.uk/wp-content/plugins/social-bookmarking-reloaded/twitter.png" title="Add 'The SEO experiment &#8211; Part 1 groundwork' to Twitter" alt="Add 'The SEO experiment &#8211; Part 1 groundwork' to Twitter" /></a></div>
<!-- Social Bookmarking Reloaded END -->]]></content:encoded>
			<wfw:commentRss>http://www.matthewbyrne.co.uk/seo/the-seo-experiment-part-1-groundwork/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
