<?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>Ashley Ford - Tutorials :: jQuery :: PHP :: CSS :: HTML5 :: Papermashup.com &#187; Web Tools</title>
	<atom:link href="http://papermashup.com/category/web-tools/feed/" rel="self" type="application/rss+xml" />
	<link>http://papermashup.com</link>
	<description>Ashley Ford - Tutorials :: jQuery :: PHP :: CSS :: HTML5 :: Papermashup.com</description>
	<lastBuildDate>Fri, 03 Feb 2012 11:28:50 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>PHP check if your website is up</title>
		<link>http://papermashup.com/php-check-if-your-website-is-up/</link>
		<comments>http://papermashup.com/php-check-if-your-website-is-up/#comments</comments>
		<pubDate>Mon, 30 Jan 2012 08:30:45 +0000</pubDate>
		<dc:creator>Ashley</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Web Tools]]></category>
		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://papermashup.com/?p=2510</guid>
		<description><![CDATA[Here&#8217;s a basic but useful snippet to either check that a website is online or domain exist. It&#8217;s a very simple function that uses CURL to check the response from a given URL. if a response is received we can &#8230; <br/> <a href="http://papermashup.com/php-check-if-your-website-is-up/">Continue reading</a>]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s a basic but useful snippet to either check that a website is online or domain exist. It&#8217;s a very simple function that uses CURL to check the response from a given URL. if a response is received we can assume that the site is up/online.</p>
<h3>The Code</h3>
<pre class="brush: php; title: ;">

       function isSiteAvailable($url)
       {
               //check, if a valid url is provided
               if(!filter_var($url, FILTER_VALIDATE_URL))
               {
                       return 'URL provided wasn\'t valid';
               }

               //make the connection with curl
               $cl = curl_init($url);
               curl_setopt($cl,CURLOPT_CONNECTTIMEOUT,10);
               curl_setopt($cl,CURLOPT_HEADER,true);
               curl_setopt($cl,CURLOPT_NOBODY,true);
               curl_setopt($cl,CURLOPT_RETURNTRANSFER,true);

               //get response
               $response = curl_exec($cl);

               curl_close($cl);

               if ($response) return 'Site seems to be up and running!';

               return 'Oops nothing found, the site is either offline or the domain doesn\'t exist';
       }

	// check if site exists / is up
	if($_GET['url']){

	   $response = isSiteAvailable($_GET['url']);
	   $message = '&lt;div class=&quot;response&quot;&gt;'.$response.'&lt;/div&gt;';
	}
</pre>
<h3>Display the response</h3>
<pre class="brush: php; title: ;">

&lt;?php echo $message;?&gt;

&lt;form action=&quot;&quot; method=&quot;get&quot;&gt;

Enter a URL below or click an example below:&lt;br/&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;?url=http://harkable.com&quot;&gt;harkable.com&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;?url=http://google.com&quot;&gt;google.com&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;?url=http://sfdhjsdkhfskjfhskjfh.om&quot;&gt;sfdhjsdkhfskjfhskjfh.om&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;input name=&quot;url&quot; type=&quot;text&quot; value=&quot;&lt;?php echo $_GET['url'];?&gt;&quot; /&gt;

&lt;/form&gt;
</pre>
<p><a href="http://papermashup.com/demos/check-if-website-is-up/"><img src="http://papermashup.com/wp-content/uploads/2009/01/demo.png" alt="" title="demo" class="alignnone size-full wp-image-23" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://papermashup.com/php-check-if-your-website-is-up/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Display breadcrumbs on your site using PHP</title>
		<link>http://papermashup.com/how-to-display-breadcrumbs-on-your-site-using-php/</link>
		<comments>http://papermashup.com/how-to-display-breadcrumbs-on-your-site-using-php/#comments</comments>
		<pubDate>Wed, 17 Aug 2011 06:30:09 +0000</pubDate>
		<dc:creator>Ashley</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Web Tools]]></category>
		<category><![CDATA[Blogging]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://papermashup.com/?p=2411</guid>
		<description><![CDATA[When you have a fully dynamic site it&#8217;s useful to show the user where they are by breaking down the URL structure so they can navigate backwards through the site. For example this url: http://papermashup.com/categories/jquery/ shows that &#8216;jquery&#8217; is part &#8230; <br/> <a href="http://papermashup.com/how-to-display-breadcrumbs-on-your-site-using-php/">Continue reading</a>]]></description>
			<content:encoded><![CDATA[<p>When you have a fully dynamic site it&#8217;s useful to show the user where they are by breaking down the URL structure so they can navigate backwards through the site. For example this url: http://papermashup.com/categories/jquery/ shows that &#8216;jquery&#8217; is part of &#8216;categories&#8217; so the user could navigate backwards through the url structure.</p>
<h3>The Code</h3>
<p>The first line of the function gets the REQUEST_URI (/path/to/file.php), splits the string (using &#8216;/&#8217;) into an array, then filters out any empty values. We then store the base url for the site in $base_url. Next we find the array key for the last value in the $path array. We then do a for loop to build up the breadcrumbs and determine where to put the a tag etc.</p>
<pre class="brush: php; title: ;">

function breadcrumbs($separator = ' &amp;raquo; ', $home = 'Home') {

    $path = array_filter(explode('/', parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH)));
    $base_url = ($_SERVER['HTTPS'] ? 'https' : 'http') . '://' . $_SERVER['HTTP_HOST'] . '/';
    $breadcrumbs = array(&quot;&lt;a href=\&quot;$base_url\&quot;&gt;$home&lt;/a&gt;&quot;);

    $last = end(array_keys($path));

    foreach ($path AS $x =&gt; $crumb) {
        $title = ucwords(str_replace(array('.php', '_'), Array('', ' '), $crumb));
        if ($x != $last){
            $breadcrumbs[] = '&lt;a href=&quot;$base_url$crumb&quot;&gt;$title&lt;/a&gt;';
        }else{
            $breadcrumbs[] = $title;
		}
    }

    return implode($separator, $breadcrumbs);
}	
</pre>
<h3>Calling the function</h3>
<p>This is the simple bit! Simply add the above function to the top of your PHP page and call the function as shown below. You can optionally add a separator symbol or specify the wording for &#8216;Home&#8217;.</p>
<pre class="brush: php; title: ;">

echo breadcrumbs();
</pre>
]]></content:encoded>
			<wfw:commentRss>http://papermashup.com/how-to-display-breadcrumbs-on-your-site-using-php/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Create a URL from a string of text with PHP and mod_rewrite</title>
		<link>http://papermashup.com/create-a-url-from-a-string-of-text-with-php/</link>
		<comments>http://papermashup.com/create-a-url-from-a-string-of-text-with-php/#comments</comments>
		<pubDate>Tue, 16 Aug 2011 06:30:08 +0000</pubDate>
		<dc:creator>Ashley</dc:creator>
				<category><![CDATA[.htaccess]]></category>
		<category><![CDATA[Blogging]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Web Tools]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://papermashup.com/?p=2398</guid>
		<description><![CDATA[Quite often when developing big web apps you may need to use mod_rewrite to generate SEO friendly URLs from a string of text, Very similar to the way Word press generates URLs for blog posts. The Code Below is the &#8230; <br/> <a href="http://papermashup.com/create-a-url-from-a-string-of-text-with-php/">Continue reading</a>]]></description>
			<content:encoded><![CDATA[<p>Quite often when developing big web apps you may need to use mod_rewrite to generate SEO friendly URLs from a string of text, Very similar to the way Word press generates URLs for blog posts.</p>
<h3>The Code</h3>
<p>Below is the function which will remove all the spaces and special characters from a string and convert it to lowercase making sure its formated ready to be used as a page URL.</p>
<pre class="brush: php; title: ;">

function create_slug($string){
   $string = preg_replace( '/[«»&quot;&quot;!?,.!@£$%^&amp;*{};:()]+/', '', $string );
   $string = strtolower($string);
   $slug=preg_replace('/[^A-Za-z0-9-]+/', '-', $string);
   return $slug;
}

$slug = create_slug('This is my page title');

echo $slug;

// this should print out: this-is-my-page-title
</pre>
<h3>The .htaccess Code</h3>
<p>If you were to use the function above in conjunction with generating page urls as part of a web application you&#8217;ll need some way of the server handling url redirects etc. The easiest way to do this is by using .htaccess. <a href="http://papermashup.com/useful-htaccess-techniques/" title="Useful .htaccess techniques">More information can be found about .htaccess here</a>. What the code below does is, it takes the url for example &#8216;http://papermashup.com/this-is-my-page-title&#8217; then appends the; &#8216;this-is-my-page-title&#8217; as a GET variable value, in the case below we&#8217;re saving it in the GET variable &#8216;slug&#8217; which is appended to index.php. So now when we visit &#8216;http://papermashup.com/this-is-my-page-title&#8217; the server looks for http://papermashup.com/index.php?slug=this-is-my-page-title. Then it&#8217;s up to you to process the data for each url. So if you had a web app you might have a MySQL database that holds all your site URLs and data which you search based on the page slug.</p>
<pre class="brush: xml; title: ;">

RewriteEngine on
RewriteRule ^([a-zA-Z0-9-/]+)$ index.php?slug=$1 [QSA]
</pre>
]]></content:encoded>
			<wfw:commentRss>http://papermashup.com/create-a-url-from-a-string-of-text-with-php/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Creating Automatic MySQL Database backups</title>
		<link>http://papermashup.com/creating-automatic-mysql-database-backups/</link>
		<comments>http://papermashup.com/creating-automatic-mysql-database-backups/#comments</comments>
		<pubDate>Wed, 08 Jun 2011 13:49:59 +0000</pubDate>
		<dc:creator>Ashley</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Web Tools]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://papermashup.com/?p=2345</guid>
		<description><![CDATA[Every database needs to be backed up and if you&#8217;re currently doing it manually you can stop because there&#8217;s a simple solution using PHP. With this script you can either pass a specific table to backup or choose to backup &#8230; <br/> <a href="http://papermashup.com/creating-automatic-mysql-database-backups/">Continue reading</a>]]></description>
			<content:encoded><![CDATA[<p>Every database needs to be backed up and if you&#8217;re currently doing it manually you can stop because there&#8217;s a simple solution using PHP. With this script you can either pass a specific table to backup or choose to backup the whole database.</p>
<h3>How to implement</h3>
<p>The best way to use the script below is to copy the code and put it in a folder called &#8216;database_backups&#8217; as shown below. Then whenever you call the backup.php file it will create a database backup which is stored on your server. I&#8217;d recommend downloading these database backups periodically so you have a copy stored safely elsewhere incase you lose your hosting. </p>
<p><img src="http://papermashup.com/wp-content/uploads/2011/06/backup.png" alt="" title="backup" width="566" height="113" class="alignnone size-full wp-image-2349" /></p>
<h3>Using CRON</h3>
<p>Cron is a time-based job scheduler which allows you to run certain scripts at specific times. For example I have my database backups running every night at a time when traffic levels are low. You could setup a CRON job if your web host permits by running the following command. Just change the link to point to the backup file in your server.</p>
<pre class="brush: xml; title: ;">
wget -O /dev/null http://your-site.com/database_backup/backup.php
</pre>
<h3>The Code</h3>
<pre class="brush: php; title: ;">

&lt;?php
backup_database_tables('HOST','USERNAME','PASSWORD','DATABASE', '*');

// backup the db function
function backup_database_tables($host,$user,$pass,$name,$tables)
{

	$link = mysql_connect($host,$user,$pass);
	mysql_select_db($name,$link);

	//get all of the tables
	if($tables == '*')
	{
		$tables = array();
		$result = mysql_query('SHOW TABLES');
		while($row = mysql_fetch_row($result))
		{
			$tables[] = $row[0];
		}
	}
	else
	{
		$tables = is_array($tables) ? $tables : explode(',',$tables);
	}

	//cycle through each table and format the data
	foreach($tables as $table)
	{
		$result = mysql_query('SELECT * FROM '.$table);
		$num_fields = mysql_num_fields($result);

		$return.= 'DROP TABLE '.$table.';';
		$row2 = mysql_fetch_row(mysql_query('SHOW CREATE TABLE '.$table));
		$return.= &quot;\n\n&quot;.$row2[1].&quot;;\n\n&quot;;

		for ($i = 0; $i &lt; $num_fields; $i++)
		{
			while($row = mysql_fetch_row($result))
			{
				$return.= 'INSERT INTO '.$table.' VALUES(';
				for($j=0; $j&lt;$num_fields; $j++)
				{
					$row[$j] = addslashes($row[$j]);
					$row[$j] = ereg_replace(&quot;\n&quot;,&quot;\\n&quot;,$row[$j]);
					if (isset($row[$j])) { $return.= '&quot;'.$row[$j].'&quot;' ; } else { $return.= '&quot;&quot;'; }
					if ($j&lt;($num_fields-1)) { $return.= ','; }
				}
				$return.= &quot;);\n&quot;;
			}
		}
		$return.=&quot;\n\n\n&quot;;
	}

	//save the file
	$handle = fopen('db-backup-'.time().'-'.(md5(implode(',',$tables))).'.sql','w+');
	fwrite($handle,$return);
	fclose($handle);
}
?&gt;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://papermashup.com/creating-automatic-mysql-database-backups/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>jQuery UI Slider</title>
		<link>http://papermashup.com/jquery-ui-slider/</link>
		<comments>http://papermashup.com/jquery-ui-slider/#comments</comments>
		<pubDate>Thu, 19 May 2011 17:03:56 +0000</pubDate>
		<dc:creator>Ashley</dc:creator>
				<category><![CDATA[Design]]></category>
		<category><![CDATA[Downloads]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Learn]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Web Tools]]></category>
		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://papermashup.com/?p=2309</guid>
		<description><![CDATA[I&#8217;ve been hugely inspired recently by the design work of Orman Clark from Premiumpixels.com and his generous selection of top quality PSD downloads. after seeing this beautiful design of a button and slider set I was eager to code up &#8230; <br/> <a href="http://papermashup.com/jquery-ui-slider/">Continue reading</a>]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been hugely inspired recently by the design work of <a href="http://twitter.com/ormanclark">Orman Clark</a> from <a href="http://premiumpixels.com">Premiumpixels.com</a> and his generous selection of top quality PSD downloads. after seeing this beautiful <a href="http://www.premiumpixels.com/freebies/slider-interface-metal-handle-psd/">design of a button and slider</a> set I was eager to code up a working version using jQuery UI. You can grab the <a href="http://www.premiumpixels.com/freebies/slider-interface-metal-handle-psd/">PSD for the design here</a> along with tons of awesome resources.</p>
<h3>The Code</h3>
<p>Most of the code is CSS for this one so lets start here</p>
<pre class="brush: css; title: ;">

body{
background:url(bg.jpg)!important;
padding:100px 50px 0px 50px;
}

/*the slider background*/
.slider {
width:230px;
height:11px;
background:url(slider-bg.png);
position:relative;
margin:0;
padding:0 10px;
}

/*Style for the slider button*/
.ui-slider-handle {
width:24px;
height:24px;
position:absolute;
top:-7px;
margin-left:-12px;
z-index:200;
background:url(slider-button.png);
}

/*Result div where the slider value is displayed*/
#slider-result {
font-size:50px;
height:200px;
font-family:Arial, Helvetica, sans-serif;
color:#fff;
width:250px;
text-align:center;
text-shadow:0 1px 1px #000;
font-weight:700;
padding:20px 0;
}

/*This is the fill bar colour*/
.ui-widget-header {
background:url(fill.png) no-repeat left;
height:8px;
left:1px;
top:1px;
position:absolute;
}

a {
outline:none;
-moz-outline-style:none;
}
</pre>
<h3>The JavaScript</h3>
<p>Using jQuery UI is pretty painless. It&#8217;s very easy to setup you simply add a holder div for your slider, in this case we&#8217;re specifying the div with the class &#8216;.slider&#8217; we then call the slider() method passing the in some values.</p>
<pre class="brush: jscript; title: ;">
 $( &quot;.slider&quot; ).slider({
	        animate: true,
                range: &quot;min&quot;,
                value: 50,
                min: 10,
                max: 100,
				step: 10,

				//this gets a live reading of the value and prints it on the page
                slide: function( event, ui ) {
                    $( &quot;#slider-result&quot; ).html( ui.value );
                },

				//this updates the hidden form field so we can submit the data using a form
                change: function(event, ui) {
                $('#hidden').attr('value', ui.value);
                }

				});
</pre>
<h3>The HTML</h3>
<p>Pretty simple snippet of HTML&#8230;</p>
<pre class="brush: xml; title: ;">
       &lt;div class=&quot;slider&quot;&gt;&lt;/div&gt;
        &lt;div id=&quot;slider-result&quot;&gt;50&lt;/div&gt;
  	&lt;input type=&quot;hidden&quot; id=&quot;hidden&quot;/&gt;
</pre>
<p><a href="http://papermashup.com/demos/jquery-slider-bar/"><img src="http://papermashup.com/wp-content/uploads/2009/01/demo.png" alt="" title="demo" class="alignnone size-full wp-image-23" /></a><a href="http://papermashup.com/demos/jquery-slider-bar/jquery-slider-bar.zip"><img src="http://papermashup.com/wp-content/uploads/2009/01/download.png" alt="download" title="download" class="alignnone size-full wp-image-24" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://papermashup.com/jquery-ui-slider/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Automatically pull in user Gravatar images</title>
		<link>http://papermashup.com/automatically-pull-in-user-gravatar-images/</link>
		<comments>http://papermashup.com/automatically-pull-in-user-gravatar-images/#comments</comments>
		<pubDate>Thu, 20 Jan 2011 17:30:32 +0000</pubDate>
		<dc:creator>Ashley</dc:creator>
				<category><![CDATA[Design]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Web Tools]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[Downloads]]></category>
		<category><![CDATA[tools]]></category>

		<guid isPermaLink="false">http://papermashup.com/?p=2191</guid>
		<description><![CDATA[I was browsing forrst.com and saw a pretty interesting code snippet from Chris Coyier from CSS-Tricks which is pretty useful for WordPress users and allows the gravatar of a commenter to be dynamically pulled into the comment box as soon &#8230; <br/> <a href="http://papermashup.com/automatically-pull-in-user-gravatar-images/">Continue reading</a>]]></description>
			<content:encoded><![CDATA[<p>I was browsing <a href="http://forrst.com">forrst.com</a> and saw a pretty interesting code snippet from Chris Coyier from <a href="http://css-tricks.com/">CSS-Tricks</a> which is pretty useful for WordPress users and allows the gravatar of a commenter to be dynamically pulled into the comment box as soon as the user has clicked out of the email input field.</p>
<h3>The Code</h3>
<p>This code snippet is pretty easy to grasp. We&#8217;re simple replacing the background image of the div #avatar each time the user clicks out of the email input field. you&#8217;ll notice that we&#8217;re also calling the function MD5(). This is because Gravatar uses your email address encoded into an MD5 hash as an id to pull your avatar. You also need to include the function MD5() which is available in the Download.</p>
<pre class="brush: jscript; title: ;">

$(document).ready(function(){

var email = $(&quot;#email&quot;),
avatar = $(&quot;#avatar&quot;);

email.blur(function() {
avatar.css(&quot;background-image&quot;,&quot;url(http://www.gravatar.com/avatar/&quot; + MD5(email.val()) + &quot;)&quot;);

});

});
</pre>
<h3>The HTML</h3>
<pre class="brush: xml; title: ;">
&lt;div id=&quot;avatar&quot;&gt;&lt;img src=&quot;thumb.png&quot; width=&quot;80&quot; height=&quot;80&quot;/&gt;&lt;/div&gt;

&lt;form class=&quot;gravatar&quot;&gt;
&lt;input type=&quot;text&quot; onFocus=&quot;if(this.value=='Email Address') this.value='';&quot; onBlur=&quot;if(this.value=='') this.value='Email Address';&quot; value=&quot;Email Address&quot; name=&quot;s&quot; id=&quot;email&quot; /&gt;
&lt;/form&gt;
</pre>
<p><a href="http://papermashup.com/demos/gravatar-image/"><img class="alignnone size-full wp-image-23" title="demo" src="http://papermashup.com/wp-content/uploads/2009/01/demo.png" alt="" /></a><a href="http://papermashup.com/demos/gravatar-image/gravatar-image.zip"><img src="http://papermashup.com/wp-content/uploads/2009/01/download.png" alt="download" title="download" class="alignnone size-full wp-image-24" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://papermashup.com/automatically-pull-in-user-gravatar-images/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>HTML5 Geo location using the Google API</title>
		<link>http://papermashup.com/html5-geo-location-using-the-google-api/</link>
		<comments>http://papermashup.com/html5-geo-location-using-the-google-api/#comments</comments>
		<pubDate>Thu, 11 Nov 2010 17:56:19 +0000</pubDate>
		<dc:creator>Ashley</dc:creator>
				<category><![CDATA[API's]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Web Tools]]></category>
		<category><![CDATA[APIs]]></category>
		<category><![CDATA[geolocation]]></category>
		<category><![CDATA[Google]]></category>
		<category><![CDATA[maps]]></category>

		<guid isPermaLink="false">http://papermashup.com/?p=2151</guid>
		<description><![CDATA[HTML5 came on the scene around the beginning of the year, but as we&#8217;re seeing more browsers becoming more sophisticated and applications more intelligent how can we use HTML5 to our advantage and what can it do to make life a &#8230; <br/> <a href="http://papermashup.com/html5-geo-location-using-the-google-api/">Continue reading</a>]]></description>
			<content:encoded><![CDATA[<p>HTML5 came on the scene around the beginning of the year, but as we&#8217;re seeing more browsers becoming more sophisticated and applications more intelligent how can we use HTML5 to our advantage and what can it do to make life a little easier. Well one of the things we can do is plot your location on a Google map using the maps API and a touch of HTML5. <a href="http://remysharp.com/">Remy Sharp</a> a fellow UK developer wrote about this along with a demo a while back. You can see the <a href="http://papermashup.com/demos/html5-geolocation/">demo here</a>.</p>
<h3>The Code</h3>
<p>The first line of code included below is the Google API library for geo location. This code is compatible across the following browsers: Opera, FireFox, Chrome, and Safari. It will also work on Safari Mobile. </p>
<p>Using the Google Map Canvas our web browser sends our location through to the API which then plots it on the map. I&#8217;ve found it to be a bit in accurate at times but it works 80% of the time. You&#8217;ll also have to click &#8216;allow&#8217; in Google Chrome to allow your location to be shared.  </p>
<pre class="brush: jscript; title: ;">

&lt;section id=&quot;wrapper&quot;&gt;

&lt;script type=&quot;text/javascript&quot; src=&quot;http://maps.google.com/maps/api/js?sensor=true&quot;&gt;&lt;/script&gt;
    &lt;article&gt;
      &lt;p&gt;&lt;span id=&quot;status&quot;&gt;Please wait whilst we try to locate you...&lt;/span&gt;&lt;/p&gt;
    &lt;/article&gt;
&lt;script&gt;
function success(position) {
  var s = document.querySelector('#status');

  if (s.className == 'success') {
    return;
  }

  s.innerHTML = &quot;found you!&quot;;
  s.className = 'success';

  var mapcanvas = document.createElement('div');
  mapcanvas.id = 'mapcanvas';
  mapcanvas.style.height = '400px';
  mapcanvas.style.width = '560px';

  document.querySelector('article').appendChild(mapcanvas);

  var latlng = new google.maps.LatLng(position.coords.latitude, position.coords.longitude);
  var myOptions = {
    zoom: 15,
    center: latlng,
    mapTypeControl: false,
    navigationControlOptions: {style: google.maps.NavigationControlStyle.SMALL},
    mapTypeId: google.maps.MapTypeId.ROADMAP
  };
  var map = new google.maps.Map(document.getElementById(&quot;mapcanvas&quot;), myOptions);

  var marker = new google.maps.Marker({
      position: latlng,
      map: map,
      title:&quot;You are here!&quot;
  });
}

function error(msg) {
  var s = document.querySelector('#status');
  s.innerHTML = typeof msg == 'string' ? msg : &quot;failed&quot;;
  s.className = 'fail';

  // console.log(arguments);
}

if (navigator.geolocation) {
  navigator.geolocation.getCurrentPosition(success, error);
} else {
  error('not supported');
}

&lt;/script&gt;
&lt;/section&gt;
</pre>
<p><a href="http://papermashup.com/demos/html5-geolocation/"><img src="http://papermashup.com/wp-content/uploads/2009/01/demo.png" alt="" title="demo" class="alignnone size-full wp-image-23" /></a><a href="http://papermashup.com/demos/html5-geolocation/html5-geolocation.zip"><img src="http://papermashup.com/wp-content/uploads/2009/01/download.png" alt="download" title="download" class="alignnone size-full wp-image-24" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://papermashup.com/html5-geo-location-using-the-google-api/feed/</wfw:commentRss>
		<slash:comments>20</slash:comments>
		</item>
		<item>
		<title>5 tips to designing better landing pages</title>
		<link>http://papermashup.com/5-tips-to-designing-better-landing-pages/</link>
		<comments>http://papermashup.com/5-tips-to-designing-better-landing-pages/#comments</comments>
		<pubDate>Mon, 18 Oct 2010 12:34:35 +0000</pubDate>
		<dc:creator>Ashley</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Design]]></category>
		<category><![CDATA[Learn]]></category>
		<category><![CDATA[Web Tools]]></category>
		<category><![CDATA[landing pages]]></category>

		<guid isPermaLink="false">http://papermashup.com/?p=2096</guid>
		<description><![CDATA[Marketing your site to the right audience and getting your core message across is crucial in order to sell your product or service. There is no single formula to achieve this, only different strategies and tests will lead to a &#8230; <br/> <a href="http://papermashup.com/5-tips-to-designing-better-landing-pages/">Continue reading</a>]]></description>
			<content:encoded><![CDATA[<p>Marketing your site to the right audience and getting your core message across is crucial in order to sell your product or service. There is no single formula to achieve this, only different strategies and tests will lead to a landing page that suits your products needs.</p>
<h3>1. Call to action</h3>
<p><img src="http://papermashup.com/wp-content/uploads/2010/10/call-to-actions.jpg" alt="" title="call-to-actions" width="583" height="294" class="alignnone size-full wp-image-2100" /></p>
<p>Users will click on a call to action buttons because they expect to see information that a button says the next page would provide. If your users don&#8217;t quickly recognise the content on the corresponding landing page, they will leave. Therefore, make sure that whatever message your CTA button promotes is the focus of the landing page.</p>
<h3>2. Make forms easy to use</h3>
<p><img src="http://papermashup.com/wp-content/uploads/2010/10/form.jpg" alt="" title="form" width="583" height="340" class="alignnone size-full wp-image-2099" /></p>
<p>Providing the least amount of hoops to jump through for a user means your conversions will be higher. Users hate forms and complicated user flows. if you&#8217;re landing page is designed to push users to signup to your site make the process easy with the least amount of required fields, and keep the form above the page fold to maxamise its exposure.</p>
<h3>3. Clear Messaging</h3>
<p><img src="http://papermashup.com/wp-content/uploads/2010/10/mailchimp.png" alt="mailchimp - Keep it simple and to the point" title="mailchimp - Keep it simple and to the point" width="583" height="281" class="alignnone size-full wp-image-2097" /></p>
<p>You have one shot at convincing a user to buy your product or service. If you&#8217;re offering something free then make it clear what the benefits of signing up are. Make sure that your marketing campaign has continuity when it comes to design and messaging. As a user you don&#8217;t want to click a banner and be greeted by a page that bears no relevance to the message you&#8217;ve just seen</p>
<h3>4. Give a little extra</h3>
<p><img src="http://papermashup.com/wp-content/uploads/2010/10/giveaways.jpg" alt="" title="giveaways" width="583" height="294" class="alignnone size-full wp-image-2107" /></p>
<p>Everyone loves a free lunch. Add value to your product by giving a little more away. Even the opportunity to win a t-shirt is enough to get users interested in your product.</p>
<h3>5. Engage your audience</h3>
<p><img src="http://papermashup.com/wp-content/uploads/2010/10/video.jpg" alt="" title="video" width="583" height="294" class="alignnone size-full wp-image-2109" /></p>
<p>The use of online video viewership, by both businesses and consumers, is at an all time high. The average person watches 180 videos online each month. These are statistics just can&#8217;t be ignored. Video is a great medium to engage your audience and simple informative content can work wonders to drive conversions.</p>
<p>Check out the <a href="http://www.mailchimp.com/v5-3/">Mailchimp landing page</a> to promote their free product as well as their <a href="http://www.mailchimp.com/v5-2/">social tools</a></p>
]]></content:encoded>
			<wfw:commentRss>http://papermashup.com/5-tips-to-designing-better-landing-pages/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>jQuery form titles</title>
		<link>http://papermashup.com/jquery-form-titles/</link>
		<comments>http://papermashup.com/jquery-form-titles/#comments</comments>
		<pubDate>Wed, 07 Jul 2010 09:10:14 +0000</pubDate>
		<dc:creator>Ashley</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Design]]></category>
		<category><![CDATA[featured]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Learn]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Web Tools]]></category>
		<category><![CDATA[Downloads]]></category>
		<category><![CDATA[forms]]></category>

		<guid isPermaLink="false">http://papermashup.com/?p=1986</guid>
		<description><![CDATA[I thought I&#8217;d share a little technique that I occasionally use when coding forms with a limited amount of space. It&#8217;s a simple effect that allows you to contain the form input or textarea title within the form allowing the &#8230; <br/> <a href="http://papermashup.com/jquery-form-titles/">Continue reading</a>]]></description>
			<content:encoded><![CDATA[<p>I thought I&#8217;d share a little technique that I occasionally use when coding forms with a limited amount of space. It&#8217;s a simple effect that allows you to  contain the form input or textarea title within the form allowing the user to click inside the form input to remove it. You often see this used on search fields</p>
<h3>The JavaScript</h3>
<p>firstly we assign a class of &#8216;form-field&#8217; as well as adding the attribute &#8216;defaultVal&#8217; with the text that we want to display in our input field.</p>
<p>The code below simply adjusts the input value attribute depending on if the user click in the field and types text so we have a state of change for &#8216;focus&#8217; and &#8216;blur&#8217;.</p>
<pre class="brush: jscript; title: ;">
$(document).ready(function(){

  $('.form-field').each( function () {
    $(this).val($(this).attr('defaultVal'));
    $(this).css({color:'#ccc'});
      });

  $('.form-field').focus(function(){
    if ( $(this).val() == $(this).attr('defaultVal') ){
      $(this).val('');
      $(this).css({color:'#000'});
    }
    });
  $('.form-field').blur(function(){
    if ($(this).val() == '' ){
      $(this).val($(this).attr('defaultVal'));
      $(this).css({color:'#ccc'});
    }
    });

});
</pre>
<h3>The HTML</h3>
<pre class="brush: xml; title: ;">
 &lt;form method=&quot;post&quot; action=&quot;&quot;&gt;

	    &lt;input type=&quot;text&quot; class=&quot;form-field&quot; name=&quot;Name&quot; defaultVal=&quot;Name&quot; value=&quot;&quot; /&gt;
            &lt;input type=&quot;text&quot; class=&quot;form-field&quot; name=&quot;Phone&quot; defaultVal=&quot;Phone Number&quot; value=&quot;&quot; /&gt;
            &lt;input type=&quot;text&quot; class=&quot;form-field&quot; name=&quot;Email&quot; defaultVal=&quot;Email address&quot; value=&quot;&quot; /&gt;
            &lt;input type=&quot;text&quot; class=&quot;form-field&quot; name=&quot;Url&quot; defaultVal=&quot;Site URL&quot; value=&quot;&quot; /&gt;

	&lt;/form&gt;
</pre>
<p><a href="http://papermashup.com/demos/jquery-form-titles/"><img class="alignnone size-full wp-image-23" title="demo" src="http://papermashup.com/wp-content/uploads/2009/01/demo.png" alt="" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://papermashup.com/jquery-form-titles/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>MySpace Open Search API</title>
		<link>http://papermashup.com/myspace-open-search-api/</link>
		<comments>http://papermashup.com/myspace-open-search-api/#comments</comments>
		<pubDate>Sun, 04 Jul 2010 20:47:21 +0000</pubDate>
		<dc:creator>Ashley</dc:creator>
				<category><![CDATA[API's]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Web Tools]]></category>
		<category><![CDATA[APIs]]></category>
		<category><![CDATA[Downloads]]></category>
		<category><![CDATA[MySpace]]></category>
		<category><![CDATA[Open Search]]></category>

		<guid isPermaLink="false">http://papermashup.com/?p=1957</guid>
		<description><![CDATA[The MySpace Search API allows you to search MySpace for user, videos, images, and music. With an individual feed for each search item. It is designed to function like a search on the MySpace website and to have a response &#8230; <br/> <a href="http://papermashup.com/myspace-open-search-api/">Continue reading</a>]]></description>
			<content:encoded><![CDATA[<p>The MySpace Search API allows you to search MySpace for user, videos, images, and music. With an individual feed for each search item. It is designed to function like a search on the MySpace website and to have a response format that is compatible with OpenSocial. The API returns either JSON or XML and in this tutorial i&#8217;ll be using PHP and CURL to parse an XML response to build a simple MySpace search page.</p>
<h3>Application use</h3>
<p>Open Search could be used to mash data using the MySpace API with other applications, for example automatically pulling in a users MySpace profile image, name, location and URL.  Building a Facebook application that recommends bands to you on MySpace.</p>
<p><img class="alignnone size-full wp-image-1963" title="MySpace api" src="http://papermashup.com/wp-content/uploads/2010/07/myspace-api.jpg" alt="" width="583" height="213" /></p>
<h3>The Code</h3>
<p>Just like the Twitter search API tutorial that I did a last year we&#8217;re using the CURL function in PHP5 to allow us to parse the XML file and format the data that we get back.</p>
<h3>Here&#8217;s how it works</h3>
<p>Any search that we make will send GET variables through the page URL therefore making it easy to see the data that we&#8217;re sending to the API generally you will see search pages use this method as we&#8217;re not transmitting private data such as usernames or passwords.</p>
<p>The search data is stored in the variable $q if nothing is searched for initially we run a default search mainly for demo purposes with the search term &#8216;Coldplay&#8217;. You&#8217;ll notice that the first result on the left is highlighted green, this is because it is the official profile for the Coldplay. you can see that we construct the URL and store it in the variable $search. There are many different variables that can be passed to the API. It&#8217;s worth pointing out that we&#8217;re using the People search call. You can see all the values that can be passed in <a href="http://wiki.developer.myspace.com/index.php?title=Open_Search#Searching_for_People">here</a></p>
<p>Here is an example XML request: <a href="http://api.myspace.com/opensearch/people?searchTerms=ferrari&amp;format=xml">http://api.myspace.com/opensearch/people?searchTerms=ferrari&amp;format=xml</a></p>
<pre class="brush: php; title: ;">

//Search API Script

$q=$_GET['q'];

if($_GET['q']==''){

$q = 'coldplay';

}

if($_GET['pics']==1){

$pics[0] = '&amp;hasPhoto=on';
$pics[1] = 'checked';

}

if(!empty($_GET['location'])){

$pics[0] = '&amp;location='.urlencode($_GET['location']).'';

}

$search = &quot;http://api.myspace.com/opensearch/people?searchTerms=&quot;.urlencode($q).&quot;&amp;format=xml&quot;.$pics[0].&quot;&quot;;

$cu = curl_init();

curl_setopt($cu, CURLOPT_URL, $search);
curl_setopt($cu, CURLOPT_RETURNTRANSFER, TRUE);
$result = curl_exec($cu);
$search_res = new SimpleXMLElement($result);

echo &quot;&lt;h3&gt;&quot;.$search_res-&gt;totalResults.&quot; MySpace results for '&quot;.$q.&quot;'&lt;/h3&gt;&quot;;

// Echo the Search Data

foreach ($search_res-&gt;entry as $user) {

$officialprofile = null;

if($user-&gt;isOfficial==1){

$officialprofile = 'official';

}

echo &quot;&lt;div class='user &quot;.$officialprofile.&quot;'&gt;&lt;a href=\&quot;&quot;.$user-&gt;profileUrl.&quot;\&quot; target=\&quot;_blank\&quot;&gt;&lt;img border=\&quot;0\&quot; width=\&quot;68\&quot; class=\&quot;user_image\&quot; src=\&quot;&quot;.$user-&gt;thumbnailUrl.&quot;\&quot; title=\&quot;&quot;.$user-&gt;displayName.&quot;\&quot; /&gt;&lt;/a&gt;&quot;;
echo &quot;&lt;div class='text'&gt;&quot;.$user-&gt;displayName.&quot;&lt;/div&gt; &lt;strong&gt;&quot;.$user-&gt;location.&quot;&lt;/strong&gt;&lt;br/&gt;&lt;a href='&quot;.$user-&gt;profileUrl.&quot;' &gt;Visit &quot;.$officialprofile.&quot; profile&lt;/a&gt;&lt;div class='clear'&gt;&lt;/div&gt;&lt;/div&gt;&quot;;

}

curl_close($cu);
</pre>
<pre class="brush: php; title: ;">
&lt;div id=&quot;search&quot;&gt;
&lt;form action=&quot;&quot; method=&quot;get&quot;&gt;
  Search MySpace &lt;input type=&quot;text&quot; name=&quot;q&quot; value=&quot;&lt;?php echo $q;?&gt;&quot; id=&quot;searchbox&quot; /&gt;
 Location &lt;input type=&quot;text&quot; name=&quot;location&quot; value=&quot;&lt;?php echo $_GET['location'];?&gt;&quot; id=&quot;location&quot; /&gt;
  Only show users with profile pics &lt;input name=&quot;pics&quot; type=&quot;checkbox&quot; value=&quot;1&quot; &lt;?php echo $pics[1];?&gt; /&gt;
  &lt;input type=&quot;submit&quot; name=&quot;submit&quot; id=&quot;submit&quot; value=&quot;Search&quot; /&gt;

&lt;/form&gt;
&lt;/div&gt;
</pre>
<p><a href="http://papermashup.com/demos/myspace-open-search/"><img class="alignnone size-full wp-image-23" title="demo" src="http://papermashup.com/wp-content/uploads/2009/01/demo.png" alt="" /></a><a href="http://papermashup.com/demos/myspace-open-search/myspace-open-search.zip"><img class="alignnone size-full wp-image-24" title="download" src="http://papermashup.com/wp-content/uploads/2009/01/download.png" alt="" /></a> </p>
]]></content:encoded>
			<wfw:commentRss>http://papermashup.com/myspace-open-search-api/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using disk: enhanced
Database Caching 1/30 queries in 0.113 seconds using disk: basic
Object Caching 875/934 objects using disk: basic

Served from: papermashup.com @ 2012-02-04 03:38:13 -->
