<?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>Cagintranet Web Design &#187; Tutorials</title>
	<atom:link href="http://www.cagintranet.com/cat/tutorials/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.cagintranet.com</link>
	<description>Pittsburgh Web Design Â» Cagintranet Web Design - Web Designer, Developer, Graphic Artist and Web 2.0 Guru</description>
	<lastBuildDate>Thu, 25 Mar 2010 10:32:42 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Create Google Static Area Maps with Latitude &amp; Longitude Boundaries</title>
		<link>http://www.cagintranet.com/archive/google-static-area-maps-latitude-longitude/</link>
		<comments>http://www.cagintranet.com/archive/google-static-area-maps-latitude-longitude/#comments</comments>
		<pubDate>Wed, 10 Feb 2010 18:17:49 +0000</pubDate>
		<dc:creator>Chris Cagle</dc:creator>
				<category><![CDATA[API]]></category>
		<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://www.cagintranet.com/?p=667</guid>
		<description><![CDATA[<a href="http://www.cagintranet.com/archive/google-static-area-maps-latitude-longitude/"><img align="left" hspace="5" width="250" src="http://maps.google.com/maps/api/staticmap?path=color:blue|weight:4|fillcolor:black|40.5059,-80.0614|40.5123,-80.0504|40.5062,-80.0453|40.5066,-80.0336|40.5023,-80.0337|40.4999,-80.0456|40.4885,-80.0452|40.4837,-80.0518|40.5023,-80.0791|40.5151,-80.1205|40.531,-80.11|40.5283,-80.1076|40.5271,-80.111|40.5208,-80.1056|40.5133,-80.0926|40.5178,-80.0932|40.5212,-80.0879|40.5205,-80.0753|40.5233,-80.0718|40.5201,-80.0611|40.5059,-80.0614&size=500x300&sensor=false&key=ABQIAAAA_6h1iP7xkNWbJaJtdQExbxQoasim_Ec9007jwQbCPHO_oeeE-RTam6RjbglJrcjrbo6lqh5Wmpn8uQ" class="alignleft wp-post-image tfe" alt="" title="" /></a>This tutorial shows you how to use the little known Google Static Maps feature to outline a specific boundary such a zip code or a city. It requires that you have your own Google Maps API. Above is the output image generated by the code below. This is the PHP code that is needed. The [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://maps.google.com/maps/api/staticmap?path=color:blue|weight:4|fillcolor:black|40.5059,-80.0614|40.5123,-80.0504|40.5062,-80.0453|40.5066,-80.0336|40.5023,-80.0337|40.4999,-80.0456|40.4885,-80.0452|40.4837,-80.0518|40.5023,-80.0791|40.5151,-80.1205|40.531,-80.11|40.5283,-80.1076|40.5271,-80.111|40.5208,-80.1056|40.5133,-80.0926|40.5178,-80.0932|40.5212,-80.0879|40.5205,-80.0753|40.5233,-80.0718|40.5201,-80.0611|40.5059,-80.0614&#038;size=500x300&#038;sensor=false&#038;key=ABQIAAAA_6h1iP7xkNWbJaJtdQExbxQoasim_Ec9007jwQbCPHO_oeeE-RTam6RjbglJrcjrbo6lqh5Wmpn8uQ" alt="" /></p>
<p>This tutorial shows you how to use the little known <a href="http://code.google.com/apis/maps/documentation/staticmaps/">Google Static Maps</a> feature to outline a specific boundary such a zip code or a city. It requires that you have your own <a href="http://code.google.com/apis/maps/">Google Maps API</a>. Above is the output image generated by the code below.</p>
<p>This is the PHP code that is needed. The tricky part is finding the latitude and longitude points of the particular area you want to draw. I got my data for <a href="http://buyapittsburghhome.com/">BuyAPittsburghHome.com</a> systematically from <a href="http://www.pushpin.com/">PushPin&#8217;s API</a>.</p>
<h3>The PHP</h3>
<pre><code class="php">
# Google Maps API Key (replace with your key)
$apikey="ABQIAAAA_6h1iP7xkNWbJaJtdQExbxQoasim_Ec9007jwQbCPHO_oeeE-RTam6RjbglJrcjrbo6lqh5Wmpn8uQ";

# $latlon is a variable pulled from MySQL that stores all the latitude and longitude points of a particular area.
# In your case, you would probably have a database connection followed by sql that pulls the respective data needed.
# Since I cannot tell you where/how to pull the data from your own database, I am just going to set it here manually.
$latlon = 'a:21:{i:0;a:2:{i:0;s:8:"-80.0614";i:1;s:7:"40.5059";}i:1;a:2:{i:0;s:8:"-80.0504";i:1;s:7:"40.5123";}i:2;a:2:{i:0;s:8:"-80.0453";i:1;s:7:"40.5062";}i:3;a:2:{i:0;s:8:"-80.0336";i:1;s:7:"40.5066";}i:4;a:2:{i:0;s:8:"-80.0337";i:1;s:7:"40.5023";}i:5;a:2:{i:0;s:8:"-80.0456";i:1;s:7:"40.4999";}i:6;a:2:{i:0;s:8:"-80.0452";i:1;s:7:"40.4885";}i:7;a:2:{i:0;s:8:"-80.0518";i:1;s:7:"40.4837";}i:8;a:2:{i:0;s:8:"-80.0791";i:1;s:7:"40.5023";}i:9;a:2:{i:0;s:8:"-80.1205";i:1;s:7:"40.5151";}i:10;a:2:{i:0;s:6:"-80.11";i:1;s:6:"40.531";}i:11;a:2:{i:0;s:8:"-80.1076";i:1;s:7:"40.5283";}i:12;a:2:{i:0;s:7:"-80.111";i:1;s:7:"40.5271";}i:13;a:2:{i:0;s:8:"-80.1056";i:1;s:7:"40.5208";}i:14;a:2:{i:0;s:8:"-80.0926";i:1;s:7:"40.5133";}i:15;a:2:{i:0;s:8:"-80.0932";i:1;s:7:"40.5178";}i:16;a:2:{i:0;s:8:"-80.0879";i:1;s:7:"40.5212";}i:17;a:2:{i:0;s:8:"-80.0753";i:1;s:7:"40.5205";}i:18;a:2:{i:0;s:8:"-80.0718";i:1;s:7:"40.5233";}i:19;a:2:{i:0;s:8:"-80.0611";i:1;s:7:"40.5201";}i:20;a:2:{i:0;s:8:"-80.0614";i:1;s:7:"40.5059";}}';

# unserialize the code taken from your mySQL database. If your data is not serialized, comment this line out
$bounds = unserialize($latlon);

if ($bounds) {
	# cycle thru each lat/lon pair, concatenate and make pipe-delimited
	foreach ($bounds as $point) {
 		$latlon .= "%7C".$point[1].",".$point[0];
	}

	# build the image url
	$path = "color:blue|weight:4|fillcolor:black". $latlon;
	$MapAreaImage = "http://maps.google.com/maps/api/staticmap?path=".$path."&#038;size=500x300&#038;sensor=false&#038;key=".$apikey;
}
</code></pre>
<h3>The HTML</h3>
<p>This is the code that then displays that drawn out area map image in HTML:</p>
<pre><code class="html">&lt;img src="&lt;?php echo $MapAreaImage; ?>" alt="" /></code></pre>
<h3>The Output</h3>
<p>The PHP and HTML combined will generate the code below as the image source. A live example of this is the header image of this post (Zip Code 15202 in Pittsburgh, PA).</p>
<pre><code class="html">&lt;img src="http://maps.google.com/maps/api/staticmap?path=color:blue|weight:4|fillcolor:black|40.5059,-80.0614|40.5123,-80.0504|40.5062,-80.0453|40.5066,-80.0336|40.5023,-80.0337|40.4999,-80.0456|40.4885,-80.0452|40.4837,-80.0518|40.5023,-80.0791|40.5151,-80.1205|40.531,-80.11|40.5283,-80.1076|40.5271,-80.111|40.5208,-80.1056|40.5133,-80.0926|40.5178,-80.0932|40.5212,-80.0879|40.5205,-80.0753|40.5233,-80.0718|40.5201,-80.0611|40.5059,-80.0614&#038;size=500x300&#038;sensor=false&#038;key=ABQIAAAA_6h1iP7xkNWbJaJtdQExbxQoasim_Ec9007jwQbCPHO_oeeE-RTam6RjbglJrcjrbo6lqh5Wmpn8uQ" alt="" /></code></pre>
]]></content:encoded>
			<wfw:commentRss>http://www.cagintranet.com/archive/google-static-area-maps-latitude-longitude/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Tutorial: How to Implement Uploadify into an Application</title>
		<link>http://www.cagintranet.com/archive/how-to-implement-uploadify-into-an-application/</link>
		<comments>http://www.cagintranet.com/archive/how-to-implement-uploadify-into-an-application/#comments</comments>
		<pubDate>Thu, 15 Oct 2009 10:00:32 +0000</pubDate>
		<dc:creator>Chris Cagle</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://www.cagintranet.com/?p=522</guid>
		<description><![CDATA[<a href="http://www.cagintranet.com/archive/how-to-implement-uploadify-into-an-application/"><img align="left" hspace="5" width="250" src="http://www.cagintranet.com/design/wp-content/uploads/2009/10/screenshot1.jpg" class="alignleft wp-post-image tfe" alt="How to Implement Uploadify into an Application" title="" /></a>Last week I showed how to implement Jcrop into an application. In this tutorial &#8211; which also pulls from my experiences developing GetSimple &#8211; I implement the jQuery plugin Uploadify. In this tutorial, we create a simple file upload script that also displays an unordered list of the files in the upload directory. The list [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.cagintranet.com/design/wp-content/uploads/2009/10/screenshot1.jpg" alt="How to Implement Uploadify into an Application" /></p>
<p>Last week I showed <a href="http://www.cagintranet.com/archive/how-to-use-jcrop-from-within-an-application/">how to implement Jcrop into an application</a>. In this tutorial &#8211; which also pulls from my experiences developing <a href="http://get-simple.info/">GetSimple</a> &#8211; I implement the jQuery plugin <a href="http://www.uploadify.com/">Uploadify</a>.</p>
<p>In this tutorial, we create a simple file upload script that also displays an unordered list of the files in the upload directory. The list of files refreshes via an ajax call every time Uploadify processes a queue.</p>
<h3>Demo</h3>
<p><a href="/code/uploadify-app/upload.php">View the demo</a> or <a href="/code/uploadify-app/uploadify-demo.zip">download the files</a></p>
<h3>The Basic HTML</h3>
<pre><code class="html">&lt;h2>Uploadify Application Demo &lt;span id="loader">&lt;img src="img/loading.gif" alt="Loading..." />&lt;/span>&lt;/h2>
&lt;div id="sidebar">
	&lt;!-- form to be replaced by uploadify -->
	&lt;form id="mainftp" action="upload.php" method="post" enctype="multipart/form-data">
		&lt;p>&lt;input type="file" name="file" id="file" />&lt;/p>
		&lt;p>&lt;input type="submit" name="submit" value="Upload" />&lt;/p>
	&lt;/form>
&lt;/div>

&lt;!-- whole div to be refreshed once uploadify is finished -->
&lt;div id="allfiles" >
	&lt;?php
		//list all files via function file included up top
		$handle = @opendir($src_folder) or die("Unable to open $src_folder");
		ListDir($handle,$src_folder);
	?>
&lt;/div></code></pre>
<h3>The PHP</h3>
<pre><code class="php">//folder where the files are stored at
//you may need to chmod this folder to 775 or 777 for it to work
$src_folder = 'files/';

//file that includes the function to list all files in ul
include("inc/file_list.php");

//if javascript is disabled, the ftp will still work
if (isset($_FILES["file"])) {
	if ($_FILES["file"]["error"] > 0) {
	  $error = 'Error Uploading!';
	} else {
    $count = '1';
    $file_loc = $path . $_FILES["file"]["name"];
    $base = $_FILES["file"]["name"];
    while ( file_exists($file_loc) ) {
		$file_loc = $path . $count.'-'. $_FILES["file"]["name"];
		$base = $count.'-'. $_FILES["file"]["name"];
		$count++;
	}
    move_uploaded_file($_FILES["file"]["tmp_name"], $file_loc);
	}
}</code></pre>
<h3>The jQuery</h3>
<pre><code class="javascript">$('#mainftp').uploadify({
	'uploader' : 'js/uploadify/uploadify.swf',
	'script' : 'js/uploadify/uploadify.php',
	'multi' : true,
	'auto' : true,
	'height' : '32',
	'width' : '250',
	'buttonImg' : 'img/browse.png',
	'cancelImg' : 'img/cancel.png',
	'folder' : 'files/',
	onProgress: function() {
		$('#loader').show();
	},
	onAllComplete: function() {
		$('#loader').hide();
		$('#allfiles').load(location.href+" #allfiles>*","");
	}
});</code></pre>
<p>Notes about this javascript:</p>
<ul>
<li>Uploadify was unzipped directly from the <a href="http://www.uploadify.com/download/">download on their site</a>. To upgrade, simply replace the <em>js/uploadify/</em> folder with the newer version.</li>
<li><b>height</b> and <b>width</b> are for the respective dimentions of your custom button image &#8211; the demo&#8217;s being in <em>img/browse.png</em></li>
<li><b>folder</b> is the location where the files will be uploaded to. This is also the folder that should be listed on line #3 of the PHP code above in the <em>$src_folder</em> variable.</li>
<li><b>$(&#8216;#loader&#8217;).show();</b> and <b>$(&#8216;#loader&#8217;).hide();</b> start and stop the loading gif that many applications use now to show that something is being uploaded/processed.</li>
<li><b>$(&#8216;#allfiles&#8217;).load(location.href+&#8221; #allfiles>*&#8221;,&#8221;");</b> &#8211; replaces the whole div with the id of <em>allfiles</em> with and updated listing with the newly uploaded files in it</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.cagintranet.com/archive/how-to-implement-uploadify-into-an-application/feed/</wfw:commentRss>
		<slash:comments>34</slash:comments>
		</item>
		<item>
		<title>Tutorial: How to Implement Jcrop into an Application</title>
		<link>http://www.cagintranet.com/archive/how-to-use-jcrop-from-within-an-application/</link>
		<comments>http://www.cagintranet.com/archive/how-to-use-jcrop-from-within-an-application/#comments</comments>
		<pubDate>Sat, 10 Oct 2009 20:17:19 +0000</pubDate>
		<dc:creator>Chris Cagle</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://www.cagintranet.com/?p=507</guid>
		<description><![CDATA[<a href="http://www.cagintranet.com/archive/how-to-use-jcrop-from-within-an-application/"><img align="left" hspace="5" width="250" src="http://www.cagintranet.com/design/wp-content/uploads/2009/10/screenshot.jpg " class="alignleft wp-post-image tfe" alt="How to use Jcrop from within an Application - Tutorial" title="" /></a>When creating the &#8216;image control panel&#8217; for the latest version of GetSimple, I decided to integrate the wonderful Jcrop jQuery plugin into it. Amazingly, there are very few tutorials online that show the full extent of how to use Jcrop in real world situations. The only one I found that was of use was TalkInCode&#8217;s [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.cagintranet.com/design/wp-content/uploads/2009/10/screenshot.jpg " alt="How to use Jcrop from within an Application - Tutorial" /></p>
<p>When creating the &#8216;image control panel&#8217; for the latest version of <a href="http://get-simple.info/">GetSimple</a>, I decided to integrate the wonderful <a href="http://deepliquid.com/content/Jcrop.html">Jcrop jQuery plugin</a> into it. Amazingly, there are very few tutorials online that show the full extent of how to use Jcrop in real world situations. The only one I found that was of use was <a href="http://www.talkincode.com/jcrop-extension-implementation-in-php-932.html">TalkInCode&#8217;s tutorial</a>. I did start out using that example&#8217;s ImageManipulation class, but changed it slightly so that after submission, you are brought back to the original page instead of being shown the thumbnail.</p>
<h3>Demo &amp; Features</h3>
<p><a href="http://www.cagintranet.com/code/jcrop-app/image.php?i=pittsburgh.jpg">View the Demo</a> or <a href="http://www.cagintranet.com/code/jcrop-app/jcrop-demo.zip">download the files</a>.</p>
<p>Some of the more unique features of this demo are:</p>
<ul>
<li>The aspectRatio changes to 1:1 when ctrl-Q or command-Q is pressed</li>
<li>The dimensions of the selected area are shown in an interesting way</li>
<li>Stats on the thumbnail and the current image are displayed</li>
</ul>
<h3>The Basic HTML</h3>
<p><em>The demo/download has some extra code for displaying the image stats &amp; linking of the css, js and class files.</em></p>
<pre><code class="html">&lt;!-- image for Jcrop -->
&lt;img src="&lt;?php echo $src_folder . $src; ?>" id="cropbox" />

&lt;!-- selection dimentions -->
&lt;div id="handw" class="toggle" >Selection Dimentions&lt;br />&lt;span id="picw">&lt;/span> x &lt;span id="pich">&lt;/span>&lt;/div>

&lt;!-- form that Jcrop fills in -->
&lt;form id="jcropform" action="image.php?i=&lt;?php echo $src; ?>" method="post" onsubmit="return checkCoords();">
  &lt;input type="hidden" id="x" name="x" />
  &lt;input type="hidden" id="y" name="y" />
  &lt;input type="hidden" id="w" name="w" />
  &lt;input type="hidden" id="h" name="h" />
  &lt;input type="submit" class="submit" value="Create Thumbnail" />
  &nbsp; &lt;span class="small" >&lt;em>ctrl-Q&lt;/em> or &lt;em>command-Q&lt;/em> for square&lt;/span>
&lt;/form></code></pre>
<h3>The PHP</h3>
<pre><code class="php">//the name of the passed image
//example would be:   http://myapplication.com/image.php?i=photo.jpg
$src = $_GET['i'];

//folder where the images are
$src_folder = 'images/';

//folder where the thumbnails will be saved to
//you may need to chmod 775 or 777 this folder
$thumb_folder = 'images/thumbnails/'; 

if ($_SERVER['REQUEST_METHOD'] == 'POST'){

	require('inc/imagemanipulation.php');

	$objImage = new ImageManipulation($src_folder . $src);
	if ( $objImage->imageok ) {
		$objImage->setCrop($_POST['x'], $_POST['y'], $_POST['w'], $_POST['h']);
		$objImage->save($thumb_folder . 'thumbnail.' .$src);
	} else {
		echo 'Error!';
	}
}</code></pre>
<h3>The jQuery</h3>
<pre><code class="javascript">function updateCoords(c) {
	$('#handw').show();
  $('#x').val(c.x);
  $('#y').val(c.y);
  $('#w').val(c.w);
  $('#h').val(c.h);
  $('#pich').html(c.h);
  $('#picw').html(c.w);
};

function checkCoords()
{
  if (parseInt($('#x').val())) return true;
  alert('Please select a crop region then press submit.');
  return false;
};

jQuery(document).ready(function() { 

	$(window).load(function(){
	var api = $.Jcrop('#cropbox',{
    onChange: updateCoords,
    onSelect: updateCoords,
    boxWidth: 500,
    boxHeight: 500
  });
  var isCtrl = false;
	$(document).keyup(function (e) {
		api.setOptions({ aspectRatio: 0 });
		api.focus();
		if(e.which == 17) isCtrl=false;
	}).keydown(function (e) {
		if(e.which == 17) isCtrl=true;
		if(e.which == 81 &#038;&#038; isCtrl == true) {
			api.setOptions({ aspectRatio: 1 });
			api.focus();
		}
	});
});

});
</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://www.cagintranet.com/archive/how-to-use-jcrop-from-within-an-application/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>The New &amp; Improved Way to Turn WordPress 2.7 into a Membership Community</title>
		<link>http://www.cagintranet.com/archive/the-new-improved-way-to-turn-wordpress-27-into-a-membership-communit/</link>
		<comments>http://www.cagintranet.com/archive/the-new-improved-way-to-turn-wordpress-27-into-a-membership-communit/#comments</comments>
		<pubDate>Thu, 05 Feb 2009 17:35:18 +0000</pubDate>
		<dc:creator>Chris Cagle</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://www.cagintranet.com/?p=449</guid>
		<description><![CDATA[<a href="http://www.cagintranet.com/archive/the-new-improved-way-to-turn-wordpress-27-into-a-membership-communit/"><img align="left" hspace="5" width="250" src="http://www.cagintranet.com/design/wp-content/uploads/2009/02/pghdesigners.jpg" class="alignleft wp-post-image tfe" alt="Pittsburgh Designers" title="Pittsburgh Designers" /></a>Last March I wrote an article for WPDesigner (then subsequently republished it here) detailing the ways you could use a base install of WordPress (then on version 2.3) into a membership directory with the help of just a few plugins. This worked, and still works beautifully for me over at my Pittsburgh Designers community site. [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.cagintranet.com/design/wp-content/uploads/2009/02/pghdesigners.jpg" alt="Pittsburgh Designers" title="Pittsburgh Designers" width="500" height="250" class="alignnone size-full wp-image-466" /></p>
<p>Last March I wrote an article for <a href="http://www.wpdesigner.com/2008/03/01/how-to-use-wordpress-as-a-membership-directory/">WPDesigner</a> (then subsequently <a href="http://www.cagintranet.com/archive/wp-membership-directory/">republished it here</a>) detailing the ways you could use a base install of WordPress (then on version 2.3) into a membership directory with the help of just a few plugins. This worked, and still works beautifully for me over at my <a href="http://pghdesigners.com">Pittsburgh Designers community site</a>. But since writing this article new plugins have become available with the unveiling of the completely revised WP core update 2.7.</p>
<h3>Replacing the Old Plugins</h3>
<p><img src="http://www.cagintranet.com/design/wp-content/uploads/2009/02/buyapghhome.jpg" alt="Buy a Pittsburgh Home" title="Buy a Pittsburgh Home" width="500" height="250" class="alignnone size-full wp-image-463" /></p>
<p>In my previous installations I used only three plugins: <a href="http://www.dealsway.net/plugins/wp-user-manager">Dealsway&#8217;s User Manager</a> and <a href="http://www.im-web-gefunden.de/wordpress-plugins/role-manager/">IWG&#8217;s Role Manager</a>. This time around I wanted more customization and more control over what was being shown to the users. I ended up trying every plugin I could find that might have a remote chance in helping me accomplish my end objective. The following is my final list of plugins and customization tricks that I used in creating my latest membership project: <a href="http://buyapittsburghhome.com">BUYAPITTSBURGHHOME.com</a>.</p>
<div style="display:none;" class="alert">
<p><b>Notice:</b> <a href="http://buyapittsburghhome.com">Buy A Pittsburgh Home</a> is still in beta and not open to the public yet, but if you want, please feel free to register and poke around to see how things are setup. All I ask is that if anyone happens to find any problems or bugs, to please let me know. Thanks!</p>
</div>
<h3>Profile Setup &#038; Customization</h3>
<p><img src="http://www.cagintranet.com/design/wp-content/uploads/2009/02/registerplus.jpg" alt="Register Plus" title="Register Plus" width="500" height="175" class="alignnone size-full wp-image-468" /></p>
<p>While this is arguably the most important part of the membership site, I really wasn&#8217;t looking for a replacement to the User Manager plguin I was currently using. I had no problem with it, and it was a fairly easy to use plugin. On my membership tutorial, someone suggested looking at the <a href="http://skullbit.com/wordpress-plugin/register-plus/">Register Plus</a> plugin. I decided to give it a shot, and I am glad I did. While I still needed to hack the <em><strong>/wp-admin/users-edit.php</strong></em> file to get my profile fields in the order I wanted them, I was happy with the noticeable improvements this plugin had over User Manager. </p>
<p>There are many things that Register Plus does well, but I chose it for the fact that I may need some of it&#8217;s features down the road, not particularly right now. I did like the fact that it gave you the ability to replace some of the outgoing WP themed emails surrounding the registration events, but after some testing I decided that it wasn&#8217;t the best plugin to handle this. <a href="http://www.epicalex.com/new-user-email-set-up/">New User Email Setup</a> did the trick, and made the outgoing emails completely customizable.</p>
<p>I also added the old and reliable <a href="http://wordpress.org/extend/plugins/user-photo/">User Photo</a> plugin. I had installed this on many client WP directory sites, but this is the first time I used it myself. There are a ton of options, but once you find the right combination &#8211; it&#8217;s a set it and forget it type of plugin.</p>
<p><b>Plugins I Use</b></p>
<ul>
<li><a href="http://skullbit.com/wordpress-plugin/register-plus/">Register Plus</a></li>
<li><a href="http://www.epicalex.com/new-user-email-set-up/">New User Email Setup</a></li>
<li><a href="http://wordpress.org/extend/plugins/user-photo/">User Photo</a></li>
</ul>
<p><b>Plugins I Tested (but came up short)</b></p>
<ul>
<li><a href="http://www.dealsway.net/plugins/wp-user-manager">WP User Manager</a></li>
</ul>
<h3>Admin Interface &#038; Branding</h3>
<p><img src="http://www.cagintranet.com/design/wp-content/uploads/2009/02/cyc.jpg" alt="Customize Your Community" title="Customize Your Community" width="500" height="175" class="alignnone size-full wp-image-464" /></p>
<p>One of the most important things I wanted more control over this time was to have a more customizable admin section where the members enter their profile data. There are a slew of plugins that add various levels of branding the admin dashboard, but only one went to the extent I needed.</p>
<p><a href="http://www.sugarrae.com/wordpress/cyc/">Customize your Community</a> (or CYC) was created by one of the true WordPress gurus, <a href="http://yoast.com/sugarrae-cyc/">Joost De Valk</a>. It is extremely easy to use, and works like a charm when paired with the <a href="http://www.kpdesign.net/wp-plugins/wp-hide-dashboard/">WP Hide Dashboard</a> plugin (without it, members can type in <em><b>/wp-admin/index.php</b></em> and get to your dashboard).</p>
<p>I ended up hacking the CYC plugin so I could order my custom profile fields the way I wanted them displayed, but this was just my preference, and not required at all for it to work perfectly.</p>
<p><b>Plugin I Use</b></p>
<ul>
<li><a href="http://www.sugarrae.com/wordpress/cyc/">Customize Your Community</a></li>
</ul>
<p><b>Plugins I Tested (but came up short)</b></p>
<ul>
<li><a href="http://pressingpixels.com/wordpress-custom-admin-branding">Custom Admin Branding</a></li>
<li><a href="http://bavotasan.com/tidbits/add-your-logo-to-the-wordpress-admin-and-login-page/">Add Logo to Admin</a></li>
<li><a href="http://www.jamesdimick.com/creations/easy-admin-color-schemes/">Easy Admin Color Schemes</a></li>
</ul>
<h3>Displaying Authors</h3>
<p><img src="http://www.cagintranet.com/design/wp-content/uploads/2009/02/authorpermalink.jpg" alt="Author Permalink" title="Author Permalink" width="500" height="175" class="alignnone size-full wp-image-462" /></p>
<p>As soon as I found <a href="http://dardna.com/custom-author-permalink">Custom Author Permalink</a>, I knew it was a godsend. Anyone wanting to get rid of the awful <em><strong>/author/</strong></em> permalink structure needs this plugin. The great thing about it is that you can activate the plugin just to set the permalink, then deactivate immediately afterward &#8211; it doesn&#8217;t have to always be &#8216;on&#8217; to work.</p>
<p>In my old setup, I needed to &#8216;approve&#8217; a member by creating a new post on their behalf in order for their profile page to become visible. Now, the plugin <a href="http://wordpress.org/extend/plugins/show-authors-without-posts/">Show authors without posts</a> takes care of this for me. One problem is that now that every profile is visible, I had to reverse engineer a little PHP code to check to see if certain profile fields met certain criteria, otherwise I would just do a redirect back to the site&#8217;s homepage.</p>
<p><b>Plugins I Use</b></p>
<ul>
<li><a href="http://dardna.com/custom-author-permalink">Custom Author Permalink</a></li>
<li><a href="http://wordpress.org/extend/plugins/show-authors-without-posts/">Show authors without posts</a></li>
</ul>
<p><b>Plugins I Tested (but came up short)</b></p>
<ul>
<li><a href="http://techbasedmarketing.com/plugins/">List Authors Plus</a></li>
</ul>
<h3>WordPress Security</h3>
<p><img src="http://www.cagintranet.com/design/wp-content/uploads/2009/02/recaptcha.jpg" alt="reCAPTCHA" title="reCAPTCHA" width="500" height="175" class="alignnone size-full wp-image-467" /></p>
<p>To be honest, I didn&#8217;t have much in the way of security back when I created my original membership directory. Now, since there are a slew of great security related plugins available, I definitely made this a high priority. </p>
<p>My biggest problem was that I had a ton of spam registrations &#8211; a problem that seems to plague many WordPress site administrators. While you can never stop a registration strictly because someone wants to look around, I found that <a href="http://www.blaenkdenum.com/wp-recaptcha/">WP-reCAPTCHA</a> took care of all the spam registrations once and for all. Although the Register Plus plugin gave me the ability to implement CAPTCHA, this plugin gave me more customizable options.</p>
<p>Another problem of mine was that although I relied on <a href="http://www.im-web-gefunden.de/wordpress-plugins/role-manager/">Role Manager</a> (and I still do) to restrict a member&#8217;s movement within the admin panel, I realized that there could be plenty going on in the background that I had no clue about. In came <a href="http://urbangiraffe.com/plugins/audit-trail/">Audit Trail</a> &#8211; a plugin that tracks every movement and attempt of a logged in user. The only thing I would change is for it to do is to track what was changed when a member updated his or her profile. Audit Trail already tries to capture this, but when you start adding custom profile fields it loses its functionality.</p>
<p>As I mentioned above, I still use IWG&#8217;s Role Manager plugin to restrict which actions can be done by logged in members. I teamed this with the already mentioned WP Hide Dashboard plugin, and my users can now only see what I want them to see.</p>
<p>I also installed <a href="http://semperfiwebdesign.com/plugins/wp-security-scan/">WP Security Scan</a> just to see what I could find &#8211; which at the time was nothing, but I figure this will end up finding its way onto my regular checklist.</p>
<p><b>Plugins I Use</b></p>
<ul>
<li><a href="http://www.blaenkdenum.com/wp-recaptcha/">WP-reCAPTCHA</a></li>
<li><a href="http://urbangiraffe.com/plugins/audit-trail/">Audit Trail</a></li>
<li><a href="http://www.im-web-gefunden.de/wordpress-plugins/role-manager/">Role Manager</a></li>
<li><a href="http://www.kpdesign.net/wp-plugins/wp-hide-dashboard/">WP Hide Dashboard</a></li>
<li><a href="http://semperfiwebdesign.com/plugins/wp-security-scan/">WP Security Scan</a></li>
</ul>
<p><b>Plugins I Tested (but came up short)</b></p>
<ul>
<li><a href="http://skullbit.com/wordpress-plugin/register-plus/">Register Plus</a></li>
</ul>
<h3>Miscellaneous &#038; Vital Plugins</h3>
<p><img src="http://www.cagintranet.com/design/wp-content/uploads/2009/02/misc-reglevel.jpg" alt="RegLevel" title="RegLevel" width="500" height="175" class="alignnone size-full wp-image-465" /></p>
<p><b>Statistics:</b> For this project, I wanted to see how far I could integrate a statistics package into the WordPress backend. I tried out <a href="http://blog.matrixagents.org/wp-plugins/">StatPress Reloaded</a> and <a href="http://tantannoodles.com/toolkit/wordpress-reports/">WordPress Reports</a>, but in the end kept with my reliable stalwarts Statcounter and Google Analytics. I think the next plugin I want to test is for <a href="http://skullbit.com/wordpress-plugin/minty-fresh/">Mint</a>.</p>
<p><b>Database Backups:</b> Backups are essential to preserving an online community in case of a disaster and should be scheduled to run on at least a weekly basis. For me, I originally started using <a href="http://lesterchan.net/portfolio/programming/php/">WP-DBManager</a>, but after finding that it never really took a complete backup (presumably because of my horrible host) I switched to <a href="http://www.ilfilosofo.com/blog/wp-db-backup">WordPress Database Backup</A> and never looked back.</p>
<p><b>SEO:</b> I am not sure how useful sitemaps are to the search engines, but I figured creating one wouldn&#8217;t hurt. I only tried <a href="http://www.arnebrachhold.de/redir/sitemap-home/">Google XML Sitemaps</a>, and stuck with it because looked to be the best right from the start. I also chose to install <a href="http://techblissonline.com/platinum-seo-pack/">Platinum SEO Pack</a> for the flexibility it gave when creating the page titles.</p>
<p><b>Development:</b> <a href="http://wordpress.designpraxis.at/plugins/wp-phpmyadmin/">WP-phpMyAdmin</a> and <a href="http://gaarai.com/wp-easy-uploader/">WP Easy Uploader</a> were essential for me when I was doing development work on the site. With these two, my time in development was greatly reduced. </p>
<p><b>Other Usefuls:</b> Here is the rest of the list I used when creating my community: <a href="http://ocaoimh.ie/wp-super-cache/">WP Super Cache</a>, <a href="http://www.thedailyblitz.org/weasels-html-bios">Weasel&#8217;s HTML Bios</a>, <a href="http://www.bin-co.com/tools/wordpress/plugins/article_templates/">Article Templates</a>, <a href="http://www.webmaster-source.com/wp125-ad-plugin-wordpress/">WP125</a>, <a href="http://www.cagintranet.com/archive/wp-components-plugin/">WP-Components</a></p>
<p><b>Very Promising:</b> These are quality plugins that I just don&#8217;t have a use for yet. They are ones I want to keep in my back pocket just incase I ever have a need for them: <a href="http://simplepie.org/wiki/plugins/wordpress/simplepie_plugin_for_wordpress">SimplePie Plugin for WordPress</a>, <a href="http://jumping-duck.com/wordpress/reglevel/">RegLevel</a>, <a href="http://smallwebsitehost.com/wordpress-newsletter-plugin/wordpress">WordPress Newsletter</a>, <a href="http://www.chrisabernethy.com/wordpress-plugins/member-access/">Member Access</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.cagintranet.com/archive/the-new-improved-way-to-turn-wordpress-27-into-a-membership-communit/feed/</wfw:commentRss>
		<slash:comments>63</slash:comments>
		</item>
		<item>
		<title>How to: Sync Emails between your Blackberry and Outlook</title>
		<link>http://www.cagintranet.com/archive/how-to-sync-emails-between-your-blackberry-and-outlook/</link>
		<comments>http://www.cagintranet.com/archive/how-to-sync-emails-between-your-blackberry-and-outlook/#comments</comments>
		<pubDate>Wed, 22 Oct 2008 01:31:15 +0000</pubDate>
		<dc:creator>Chris Cagle</dc:creator>
				<category><![CDATA[Business]]></category>
		<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://www.cagintranet.com/?p=385</guid>
		<description><![CDATA[<a href="http://www.cagintranet.com/archive/how-to-sync-emails-between-your-blackberry-and-outlook/"><img align="left" hspace="5" width="250" src="http://www.cagintranet.com/design/wp-content/uploads/2008/10/bbcurve.jpg" class="alignleft wp-post-image tfe" alt="" title="Blackberry Curve" /></a>When I started my home business, I had no way of checking my email unless I was physically at home. This worked for about a year, but after not responding to some important emails in a timely fashion, I knew I had to change something. In came my first Blackberry Curve. I loved it, and [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.cagintranet.com/design/wp-content/uploads/2008/10/bbcurve.jpg" alt="" title="Blackberry Curve" class="alignnone size-full wp-image-393" /></p>
<p>When I started my home business, I had no way of checking my email unless I was physically at home. This worked for about a year, but after not responding to some important emails in a timely fashion, I knew I had to change something.</p>
<p>In came my first <a href="http://na.blackberry.com/eng/devices/device-detail.jsp?navId=H0,C221,P483">Blackberry Curve</a>. </p>
<p>I loved it, and it was a breeze to setup using the setup wizard that came on the device. The only problem, I noticed, was that there was no easy way to sync emails between my Outlook 2003 (insert your desktop client here) and my Blackberry. Actually I read on many forums that it was virtually impossible without a <a href="http://en.wikipedia.org/wiki/BlackBerry_Enterprise_Server">BES server</a>.</p>
<p>Blackberry apparently only allows you to sync your tasks, calendar and contacts though the Desktop Manager &#8211; nothing else. The important thing to me were to have the emails synced, but forum after forum, I found people telling me it couldn&#8217;t be done.</p>
<h3>Moving to Gmail</h3>
<p><img src="http://www.cagintranet.com/design/wp-content/uploads/2008/10/gmailsetup.gif" alt="" title="Gmail" class="alignnone size-full wp-image-393" /></p>
<p>I lived with the fact that my Blackberry had no idea what my Outlook was doing and vice versa for almost 5 months until I was forced to move my whole email setup from <a href="http://www.godaddy.com/">GoDaddy&#8217;s</a> servers into <a href="http://www.google.com/a/cpanel/domain/new">Google Apps</a> because of GoDaddy&#8217;s horrible email limitations.</p>
<p>Moving my <em>admin @ cagintranet.com</em> email address was pretty simple using Google Apps for Business. It is a free service, and all it took was setting up a couple new CNAME entries within GoDaddy&#8217;s domain control panel (which Google had tutorials walking me through the whole process). </p>
<h3>Outlook Setup</h3>
<p><img src="http://www.cagintranet.com/design/wp-content/uploads/2008/10/outlook.jpg" alt="" title="Outlook" class="alignnone size-full wp-image-393" /></p>
<p>Setting up Outlook was pretty easy too, and I originally settled on connecting to my new Gmail account via regular old POP3 access, but later switched it to <a href="http://en.wikipedia.org/wiki/Internet_Message_Access_Protocol">IMAP</a>. I did this because by using IMAP, I was able to keep what I did in Outlook synced with what Gmail saw. If I moved an email into a folder within Outlook, it was moved into a corresponding &#8220;label&#8221; within Gmail. When I sent an email, it was placed in my Outlook&#8217;s Sent Itmes folder as well as the Sent Items in Gmail. Anyway, you get the hint, so after taking the next hour or so moving all my old emails from Outlook into my new Gmail account, I was ready to reset up my Blackberry to connect to Google&#8217;s servers.</p>
<p><strong>Disclaimer:</strong> You can use any desktop client (Mail, Thunderbird, etc.) to interface between Gmail and your computer &#8211; I have Outlook, which is why I used it in this example. </p>
<h3>Blackberry Setup</h3>
<p>Because I switched email servers, I had to go into the &#8220;Personal Email Set Up&#8221; icon on my Blackberry and delete the <em>admin @ cagintranet</em> account that was already there.</p>
<p>Using the default setup wizard when adding a new account to the Blackberry, uses the <a href="http://en.wikipedia.org/wiki/Pop3">POP3 connection protocol</a>. POP3 is fine, but it is what was stopping me from having any sort of two-way email sync with Outlook. I decided to poke around the internet for an alternative, and lo and behold, I found a Google article <a href="http://mail.google.com/support/bin/answer.py?hl=en&#038;answer=14748">detailing the steps needed to setup a Blackberry via IMAP</a>.</p>
<p><img src="http://www.cagintranet.com/design/wp-content/uploads/2008/10/gmail.gif" alt="" title="Gmail" class="alignnone size-full wp-image-393" /></p>
<p>The steps in that article are a little long (22 in all), but they were easy to follow and the outcome was perfect. I now have my Outlook desktop client syncing with my Gmail account which also syncs with my Blackberry &#8211; all in harmonium. I realize that this only helps a select few of you out there, but I thought it could be helpful enough that I wanted to post it here.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cagintranet.com/archive/how-to-sync-emails-between-your-blackberry-and-outlook/feed/</wfw:commentRss>
		<slash:comments>41</slash:comments>
		</item>
		<item>
		<title>How to Create your own BlogCatalog Widget via their API</title>
		<link>http://www.cagintranet.com/archive/how-to-create-your-own-blogcatalog-widget-via-their-api/</link>
		<comments>http://www.cagintranet.com/archive/how-to-create-your-own-blogcatalog-widget-via-their-api/#comments</comments>
		<pubDate>Thu, 21 Aug 2008 04:00:25 +0000</pubDate>
		<dc:creator>Chris Cagle</dc:creator>
				<category><![CDATA[API]]></category>
		<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://www.cagintranet.com/?p=248</guid>
		<description><![CDATA[<a href="http://www.cagintranet.com/archive/how-to-create-your-own-blogcatalog-widget-via-their-api/"><img align="left" hspace="5" width="250" src="http://www.cagintranet.com/design/wp-content/uploads/2008/07/bc-main.jpg" class="alignleft wp-post-image tfe" alt="" title="Blog Catalog" /></a>When releasing the first version of my WP-SocialCount WordPress plugin a while back, an interested visitor asked if I would be so kind as to include a way to reshape the BlogCatalog widget with the next release of the plugin. I had every intention of doing that until I saw just how much would have [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.cagintranet.com/design/wp-content/uploads/2008/07/bc-main.jpg" alt="" title="Blog Catalog" width="500" height="171" class="alignnone size-full wp-image-254" /></p>
<p>When releasing the first version of my <a href="http://www.cagintranet.com/archive/wp-socialcount-plugin/">WP-SocialCount WordPress plugin</a> a while back, <a href="http://45caliberweb.com/">an interested visitor</a> asked if I would be so kind as to include a way to reshape the <a href="http://www.blogcatalog.com/">BlogCatalog</a> widget with the next release of the plugin. I had every intention of doing that until I saw just how much would have to be changed in my plugin to accommodate this &#8211; so I decided to write this instead.</p>
<h3>Current BlogCatalog Widgets</h3>
<p>Currently, the list of <a href="http://www.blogcatalog.com/buttons.php">widgets that BlogCatalog provides</a> it&#8217;s users is pretty meager. Hopefully this tutorial will allow it&#8217;s members to promote themselves a little easier (and in better style!) than before.</p>
<p><img src="http://www.cagintranet.com/design/wp-content/uploads/2008/07/bc-exitingwidgetsgif.gif" alt="" title="BC\&#039;s Exiting Widgets" width="500" height="348" class="alignnone size-full wp-image-253" /></p>
<h3>Step 1: Get your API Key</h3>
<p>To get your API key, all you need to do is <a href="http://www.blogcatalog.com/">sign in</a>, and go to it&#8217;s <a href="http://www.blogcatalog.com/api/">developers page</a>. A couple sections down, you will see something like the image below. Write down your key and save it for later.</p>
<p><img src="http://www.cagintranet.com/design/wp-content/uploads/2008/07/bcapi-key.gif" alt="" title="Get the API Key" width="500" height="100" class="alignnone size-full wp-image-252" /></p>
<h3>Step 2: Construct the API Calls</h3>
<p>In order to make the API call, we need to know the structure that BlogCatalog requires the calls to be in. Looking at their <a href="http://www.blogcatalog.com/api/">developers page</a>, we see that they only have two types of calls. One is for gathering <strong>User</strong> data and the other is for getting <strong>Blog</strong> data.</p>
<p>We are going to start off using the User data api call because this should give us quite a bit of the information we need right off the bat.</p>
<p>The structure as outlined by their documentation is: <strong>http://api.blogcatalog.com/getinfo?bcwsid=[apikey]&#038;username=[username]</strong></p>
<p>Looking over this call I see that the only thing we don&#8217;t currently have is the <strong>[username]</strong>. Remember, we got the <strong>[apikey]</strong> back in Step 1.</p>
<h3>Step 3: Set Initial Variables</h3>
<p>To make our coding as easy as possible, lets set some variables right off the bat so that we can reference them anytime we need their data later on.</p>
<p><em><strong>FYI:</strong> I will be adding each new step on top of each previous step so that you can see how we build the application&#8230;</em></p>
<pre><code class="php">//Setting variables
$api = &quot;xxxxxxxxxx&quot;;		//Your API key
$username = &quot;ccagle8&quot;; 	//Your username</code></pre>
<p>FYI: I X&#8217;d out my api key, but you can easily insert your own key in here&#8230;</p>
<h3>Step 4: Use PHP to Capture Your Data</h3>
<p>Since BlogCatalog returns all their data in the form of XML (their documentation didn&#8217;t state this, but it&#8217;s the format their examples are in, so let&#8217;s run with that) we will use the <a href="http://www.php.net/simplexml_load_file">simplexml_load_file</a> php function to load the file into the variable <strong>$userfeeddata</strong>.</p>
<pre><code class="php">//Setting variables
$api = &quot;xxxxxxxxxx&quot;;		//Your API key
$username = &quot;ccagle8&quot;; 	//Your username

//Pulling API user feed data
$userfeeddata = simplexml_load_file (&quot;http://api.blogcatalog.com/getinfo?bcwsid=$api&amp;username=$username&quot;);</code></pre>
<h3>Step 5: Pull That Data Into Variables</h3>
<p>After loading that file of data into our <strong>$userfeeddata</strong> variable, we can start pulling the information we need out. You can see below that I am pulling the <em>avatar</em> and <em>url</em> from this data. How I realize the hierarchy of the data is done by doing a <a href="http://www.php.net/print_r">print_r</a> command on the <strong>$userfeeddata</strong> variable. </p>
<pre><code class="php">print_r ($userfeeddata);</code></pre>
<p>I usually add this line of code in right after we load the data, and then comment it out once I have everything that I need. After analyzing the print_r output, this is what I came up with:</p>
<pre><code class="php">//Setting variables
$api = &quot;xxxxxxxxxx&quot;;		//Your API key
$username = &quot;ccagle8&quot;; 	//Your username

//Pulling API user feed data
$userfeeddata = simplexml_load_file (&quot;http://api.blogcatalog.com/getinfo?bcwsid=$api&amp;username=$username&quot;);
//print_r ($userfeeddata);

//Loading that data into variables for later
$avatar = $userfeeddata-&gt;result-&gt;avatar;
$url = $userfeeddata-&gt;result-&gt;weblogs-&gt;weblog-&gt;url;</code></pre>
<h3>Step 6: Use this Data for the Second of our API Calls</h3>
<p>back in Step 2 we found that BC gives us two types of API calls. We already used the User data feed, but now we will make use of the Blog data feed: <strong>http://api.blogcatalog.com/bloginfo?bcwsid=[apikey]&#038;url=[blog url]</strong> </p>
<p>Just as before, we already have the <strong>[apikey]</strong> value, but we don&#8217;t yet have the <strong>[blog url]</strong>. Actually we do, and it is in the form of <strong>$url</strong>, which we got in Step 5. So, lets make another call to the API, only this time using the one to get Blog information: </p>
<pre><code class="php">//Setting variables
$api = &quot;xxxxxxxxxx&quot;;		//Your API key
$username = &quot;ccagle8&quot;; 	//Your username

//Pulling API user feed data
$userfeeddata = simplexml_load_file (&quot;http://api.blogcatalog.com/getinfo?bcwsid=$api&amp;username=$username&quot;);

//Loading that data into variables for later
$avatar = $userfeeddata-&gt;result-&gt;avatar;
$url = $userfeeddata-&gt;result-&gt;weblogs-&gt;weblog-&gt;url;

//Pulling API blog feed data
$blogfeeddata = simplexml_load_file (&quot;http://api.blogcatalog.com/bloginfo?bcwsid=$api&amp;url=$url&quot;);</code></pre>
<p>Using the print_r command again, I find a some more data that I want to pull out to include in our new widget.</p>
<pre><code class="php">//Setting variables
$api = &quot;xxxxxxxxxx&quot;;		//Your API key
$username = &quot;ccagle8&quot;; 	//Your username

//Pulling API user feed data
$userfeeddata = simplexml_load_file (&quot;http://api.blogcatalog.com/getinfo?bcwsid=$api&amp;username=$username&quot;);

//Loading that data into variables for later
$avatar = $userfeeddata-&gt;result-&gt;avatar;
$url = $userfeeddata-&gt;result-&gt;weblogs-&gt;weblog-&gt;url;

//Pulling API blog feed data
$blogfeeddata = simplexml_load_file (&quot;http://api.blogcatalog.com/bloginfo?bcwsid=$api&amp;url=$url&quot;);

//Loading that data into variables for later
$tags = $blogfeeddata-&gt;result-&gt;weblog-&gt;tags-&gt;tag;
$categories = $blogfeeddata-&gt;result-&gt;weblog-&gt;categories-&gt;category;
$bcurl = $blogfeeddata-&gt;result-&gt;weblog-&gt;bcurl;
$views = $blogfeeddata-&gt;result-&gt;weblog-&gt;views;
$rank = $blogfeeddata-&gt;result-&gt;weblog-&gt;rank;
$friends = $blogfeeddata-&gt;result-&gt;weblog-&gt;neighborhood-&gt;user;
$viewers = $blogfeeddata-&gt;result-&gt;weblog-&gt;recent_viewers-&gt;user;</code></pre>
<h3>Step 7. Echoing the Data back to the Page</h3>
<p>We have all our data mining complete, so now we can focus on sending this it out to our web page.</p>
<p>Here we are echoing out some of the user information that we received during the two API calls we did. You can see that we are showing your Avatar, which is linked to your BlogCatalog page, and your site&#8217;s number of views and rank. </p>
<pre><code class="php">//Echos out User Information
echo &quot;&lt;a href=\&quot;&quot;. $bcurl .&quot;\&quot;&gt;&lt;img src=\&quot;&quot;. $avatar .&quot;\&quot; alt=\&quot;View &quot;. $username .&quot;&#39;s BlogCatalog Profile\&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&quot;;
echo &quot;Views: &quot;. $views .&quot;&lt;br /&gt;&quot;;
echo &quot;Rank: &quot;. $rank .&quot;&lt;br /&gt;&quot;;</code></pre>
<p>The next data we want to show are the tags and categories of the blog in question. To do this, we can use a <a href="http://www.php.net/foreach">foreach</a> loop that will cycle through each tag and category and create a link back to the BlogCatalog page for each one. </p>
<p><strong>Hint:</strong> You can see that I had to sanitize the variables by converting all letters to lowercase and replace spaces with underscores in order for them to work correctly in the URL.</p>
<pre><code class="php">//Cycle through and display tags
	echo &quot;Tags:&quot;;
	$set = 0;
	foreach ($tags as $i =&gt; $tag) {
		if($set &lt; $limit){
			echo &quot;&lt;a href=\&quot;http://www.blogcatalog.com/tag/&quot;. strtolower($tag) . &quot;\&quot;&gt;&quot;. $tag .&quot;&lt;/a&gt; &quot;;
		}
		$set  ;
	}

	echo &quot;&lt;br /&gt;&quot;;

	//Cycle through and display categories
	echo &quot;Categories: &quot;;
	$set = 0;
	foreach ($categories as $i =&gt; $cat) {
		if($set &lt; $limit){
			echo &quot;&lt;a href=\&quot;http://www.blogcatalog.com/directory/&quot;. urlencode(strtolower(str_replace(&quot; &quot;, &quot;_&quot;, &quot;$cat&quot;))) . &quot;\&quot;&gt;&quot;. $cat .&quot;&lt;/a&gt; &quot;;
		}
		$set  ;
	}
</code></pre>
<p><strong>DEMO: </strong><a href="http://www.cagintranet.com/code/blog-catalog">View the final outcome of this tutorial</a> (with a little bit of CSS and HTML markup added, which you can see in the header section of the page when you do a &#8220;view source&#8221;).</p>
<p><strong>SOURCE CODE:</strong> Download the <a href='http://www.cagintranet.com/design/wp-content/uploads/2008/07/blogcatalog.phps'>full PHP source code</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cagintranet.com/archive/how-to-create-your-own-blogcatalog-widget-via-their-api/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using the WordPress Link Manager to Display Your Portfolio</title>
		<link>http://www.cagintranet.com/archive/using-the-wordpress-link-manager-to-display-your-portfolio/</link>
		<comments>http://www.cagintranet.com/archive/using-the-wordpress-link-manager-to-display-your-portfolio/#comments</comments>
		<pubDate>Mon, 11 Aug 2008 04:09:21 +0000</pubDate>
		<dc:creator>Chris Cagle</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://www.cagintranet.com/?p=224</guid>
		<description><![CDATA[<a href="http://www.cagintranet.com/archive/using-the-wordpress-link-manager-to-display-your-portfolio/"><img align="left" hspace="5" width="250" src="http://www.cagintranet.com/design/wp-content/uploads/2008/08/steveleggat.jpg" class="alignleft wp-post-image tfe" alt="" title="Portfolio at SteveLeggat.com" /></a>For web designers or other businesses alike, setting up a quality portfolio is essential. This tutorial will show you how you can use WordPress&#8217;s Link Manager to create and display your portfolio. This will allow you to use WordPress to it&#8217;s fullest extent, without the need of extra plugins or any hacked code. Step 1. [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.cagintranet.com/design/wp-content/uploads/2008/08/steveleggat.jpg" alt="" title="Portfolio at SteveLeggat.com" width="500" height="200" class="alignnone size-full wp-image-295" /></p>
<p>For web designers or other businesses alike, setting up <a href="http://www.digital-web.com/articles/the_perfect_portfolio/">a quality portfolio is essential</a>. This tutorial will show you how you can use <a href="http://codex.wordpress.org/Links_Manager">WordPress&#8217;s Link Manager</a> to create and display your portfolio. This will allow you to use WordPress to it&#8217;s fullest extent, <strong>without</strong> the need of extra plugins or any hacked code.</p>
<h3>Step 1. Supplying the Data</h3>
<p>Lets start off by populating our Links manager with some data. In the screenshot below you can see the fields that I am using:</p>
<ul>
<li><strong>Name</strong> &#8211; Client Name</li>
<li><strong>Web Address</strong> &#8211; To link back to. This can either be an internal posting explaining the project in detail or the actual client website (which is what I use).</li>
<li><strong>Description</strong> &#8211; For <em>title</em> and <em>alt</em> attributes.</li>
<li><strong>Categories</strong> &#8211; Skills that were used in creating the project. </li>
<li><strong>Advanced: Image Address</strong> &#8211; Link to the screenshot of your project</li>
<li><strong>Advanced: Notes</strong> &#8211; Description of the project</li>
</ul>
<p><img src="http://www.cagintranet.com/design/wp-content/uploads/2008/07/categoryport-full.gif" alt="" title="Create Link" width="500" height="1009" class="alignnone size-full wp-image-231" /></p>
<p>Optional fields include &#8220;<strong>Target</strong>&#8221; where you can force your links to open into a new browser window and &#8220;<strong>Keep this link private</strong>.&#8221; This is how you can set up a portfolio entry but not have it shown in the display on the site. This could be helpful for when you have a project finished, but you can&#8217;t show it until it&#8217;s live.</p>
<p>When you are finished adding all your portfolio entries, you can go to <em>Your WP Dashboard > Manage > Links</em> to see the full list. </p>
<p><img src="http://www.cagintranet.com/design/wp-content/uploads/2008/07/categoryport-2.gif" alt="" title="Manage Links" width="500" height="254" class="alignnone size-full wp-image-230" /></p>
<h3>Step 2. Display Your Portfolio</h3>
<p>WordPress has two different ways to display it&#8217;s &#8220;bookmarks&#8221; which we are now using as portfolio entries. They are <a href="http://codex.wordpress.org/Template_Tags/wp_list_bookmarks">wp_list_bookmarks</a> and <a href="http://codex.wordpress.org/Template_Tags/get_bookmarks">get_bookmarks</a></p>
<p>We will use the <em>get_bookmarks</em> template tag because it allows us to manipulate how our &#8220;bookmarks&#8221; look. The only caveat is that this template tag returns an array &#8211; which we will need to use some PHP code to parse though it. To see the data that <em>get_bookmarks</em> outputs, I quickly added this little snippet to my code:</p>
<pre><code class="php">$arr_portfolio = get_bookmarks();
print_r ($arr_portfolio);</code></pre>
<p>The <a href='http://www.cagintranet.com/design/wp-content/uploads/2008/07/getbookmarksoutput.html'>output from the print_r on get_bookmarks</a> shows how the array is structured. </p>
<p>From that file, we can decipher enough to get the rest of the data echo&#8217;d out into an unordered list. The only thing that took a little tweaking was the fact that you have to find your own categories by running SQL on the <em>wp_term_relationships</em> and <em>wp_terms</em> tables in order to derive the category names by their id and the link&#8217;s id.</p>
<pre><code class="php">&lt;?php
$arr_portfolio = get_bookmarks();
//print_r ($arr_portfolio);
echo &quot;&lt;ul&gt;&quot;;
foreach ($arr_portfolio as $site) {

   echo &quot;&lt;li&gt;&quot;;
   echo &quot;&lt;h3&gt;&quot;. $site-&gt;link_name .&quot;&lt;/h3&gt;&quot;;
   echo &quot;&lt;a href=\&quot;&quot;. $site-&gt;link_url .&quot;\&quot; title=\&quot;&quot;. $site-&gt;link_description .&quot;\&quot;&gt;&quot;;
   echo &quot;&lt;img src=\&quot;&quot;. $site-&gt;link_image .&quot;\&quot; /&gt;&lt;/a&gt;&quot;;
   echo &quot;&lt;p&gt;&quot;. $site-&gt;link_notes .&quot;&lt;/p&gt;&quot;;

   $cats = $wpdb-&gt;get_results(&quot;SELECT * FROM wp_term_relationships, wp_terms WHERE wp_term_relationships.object_id = $site-&gt;link_id AND wp_terms.term_id = wp_term_relationships.term_taxonomy_id&quot;);
   echo &quot;&lt;p&gt;Skills Used: &quot;;
   foreach ($cats as $cat) {
   	echo $cat-&gt;name .&quot;, &quot;;
   }

   echo &quot;&lt;/p&gt;&lt;/li&gt;&quot;;
}
echo &quot;&lt;/ul&gt;&quot;;
?&gt;	</code></pre>
<p>The great thing is that this code doesn&#8217;t need to be placed within <a href="http://codex.wordpress.org/The_Loop">the_Loop</a>. It will work great within it&#8217;s own template or on the sidebar.</p>
<p>View the <a href="http://www.cagintranet.com/code/demo-portfolio/">demo portfolio</a> using this code.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cagintranet.com/archive/using-the-wordpress-link-manager-to-display-your-portfolio/feed/</wfw:commentRss>
		<slash:comments>27</slash:comments>
		</item>
		<item>
		<title>Generating an Automatic Popular Post List via Del.icio.us or Digg in WordPress</title>
		<link>http://www.cagintranet.com/archive/generating-an-automatic-popular-post-list-via-delicious-or-digg-in-wordpress/</link>
		<comments>http://www.cagintranet.com/archive/generating-an-automatic-popular-post-list-via-delicious-or-digg-in-wordpress/#comments</comments>
		<pubDate>Wed, 30 Jul 2008 04:00:07 +0000</pubDate>
		<dc:creator>Chris Cagle</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://www.cagintranet.com/?p=109</guid>
		<description><![CDATA[<a href="http://www.cagintranet.com/archive/generating-an-automatic-popular-post-list-via-delicious-or-digg-in-wordpress/"><img align="left" hspace="5" width="250" src="http://www.cagintranet.com/design/wp-content/uploads/2008/07/auto-popular.jpg" class="alignleft wp-post-image tfe" alt="" title="Automatic Popular Post Lists" /></a>Photo Credit: reportergimmi A few months ago I wrote an article on how to create a popular posts list, and in the example I used a category called &#8216;Popular&#8217; to determine what was shown within the list. This approach is great for those that remember to periodically update their list by adding new posts to [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.cagintranet.com/design/wp-content/uploads/2008/07/auto-popular.jpg" alt="" title="Automatic Popular Post Lists" width="500" height="200" class="alignnone size-full wp-image-119" /></p>
<p><cite class="flickrcite"><br />
	Photo Credit: <a href="http://www.flickr.com/photos/zanotti/385622500/">reportergimmi</a><br />
</cite></p>
<p>A few months ago I wrote an article on <a href="http://www.cagintranet.com/archive/wordpress-tip-the-easy-way-to-show-a-popular-post-list/">how to create a popular posts list</a>, and in the example I used a category called &#8216;Popular&#8217; to determine what was shown within the list. This approach is great for those that remember to periodically update their list by adding new posts to that category, but I wanted a way for this to be done automatically. </p>
<h3>Auto Popular List based on Number of Comments</h3>
<p><img src="http://www.cagintranet.com/design/wp-content/uploads/2008/07/populararticles.gif" alt="" title="Popular Articles" width="242" height="187" class="imgright" />In this example I check the number of comments, and if they are greater than or equal to <strong>10</strong> (see the 8th line of the code below) then I display the post. This means that this Loop will show any post that has 10 or more comments. The <strong>$popular-&gt;query(&#39;showposts=50&#39;);</strong> at the top of the script is so that this Loop will run the &#8216;number of comments&#8217; check for each of your 50 latest posts.
<p>The trick here will be finding the happy medium between those two variables. If you have the &#8216;number of comments&#8217; variable set to low, you could get too many posts in your list that meet the criteria. But on the other hand, if you have the &#8216;showposts&#8217; variable set too low then there may not be enough posts that end up hitting on the &#8216;number of comments&#8217;. A balance needs to be met here. If it was me, I would shoot to have approximately 3 to 5 posts show up in my list. Of course, since this is a dynamically created, the number of posts shown number can change at any given time. </p>
<pre><code class="php">&lt;h3&gt;Popular Articles&lt;/h3&gt;
&lt;ul class=&quot;postlist&quot;&gt;
&lt;?php
$popular = new WP_Query();
$popular-&gt;query(&#39;showposts=50&#39;);
while ($popular-&gt;have_posts()) : $popular-&gt;the_post();
    $total = get_comments_number();
    if ($total &gt;= 10) { ?&gt;
        &lt;li&gt;&lt;a href=&quot;&lt;?php the_permalink(); ?&gt;&quot;&gt;&lt;?php the_title(); ?&gt;&lt;/a&gt; &lt;span&gt;Score: &lt;?php echo $total; ?&gt;&lt;/span&gt;&lt;/li&gt;
    &lt;?php }; ?&gt;
&lt;?php endwhile; ?&gt;</code></pre>
<h3>Auto Popular List based on Comments &amp; Del.icio.us Bookmarks</h3>
<p>This example is exactly the same except for on the <strong>$total</strong> line I use <a href="http://www.cagintranet.com/archive/wp-socialcount-plugin/">my own WP-SocialCount plugin</a> to pull in the amount of <a href="http://del.icio.us/">Del.ico.us</a> bookmarks that the post has. I feel this gives us a more complete idea of whether or not a post is really &#8220;popular&#8221; &#8212; rather than solely relying on it&#8217;s number of comments.</p>
<pre>
<code class="php">&lt;h3&gt;Popular Articles&lt;/h3&gt;
&lt;ul class=&quot;postlist&quot;&gt;
&lt;?php
$popular = new WP_Query();
$popular-&gt;query(&#39;showposts=50&#39;);
while ($popular-&gt;have_posts()) : $popular-&gt;the_post();
    $total = (get_comments_number() +  wpsocialcount(&#39;delicious&#39;, &#39;count&#39;, get_permalink()));
    if ($total &gt;= 10) { ?&gt;
        &lt;li&gt;&lt;a href=&quot;&lt;?php the_permalink(); ?&gt;&quot;&gt;&lt;?php the_title(); ?&gt;&lt;/a&gt; &lt;span&gt;Score: &lt;?php echo $total; ?&gt;&lt;/span&gt;&lt;/li&gt;
    &lt;?php }; ?&gt;
&lt;?php endwhile; ?&gt;</code></pre>
<h3>Digg too&#8230;</h3>
<p>If your posts regularly show up on <a href="http://digg.com/">Digg</a> as well, then you can use <a href="http://www.cagintranet.com/archive/wp-socialcount-plugin/">the same plugin</a> and replace the <strong>$total</strong> line (line 7) in the above example with this:</p>
<pre>
<code class="php">$total = (get_comments_number() +  wpsocialcount(&#39;delicious&#39;, &#39;count&#39;, get_permalink()) +  wpsocialcount(&#39;digg&#39;, &#39;diggs&#39;, get_permalink()));</code></pre>
<h3>Scoring Methods</h3>
<p>The default scoring will be all that all &#8216;hits&#8217; are of equal strength:<br /><strong>Total Score = Comments + Del.icio.us Bookmarks + Diggs</strong></p>
<p>Alternatively, if you feel that a Digg or Bookmark is twice as important as a regular old comment, then you could change the <strong>$total</strong> line to reflect this.</p>
<p><code class="php">$total = (get_comments_number() + 2*(wpsocialcount(&#39;delicious&#39;, &#39;count&#39;, get_permalink()) +  wpsocialcount(&#39;digg&#39;, &#39;diggs&#39;, get_permalink())));</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://www.cagintranet.com/archive/generating-an-automatic-popular-post-list-via-delicious-or-digg-in-wordpress/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Creating a Simple Online Application using the Flickr API</title>
		<link>http://www.cagintranet.com/archive/creating-a-simple-php-application-using-the-flickr-api/</link>
		<comments>http://www.cagintranet.com/archive/creating-a-simple-php-application-using-the-flickr-api/#comments</comments>
		<pubDate>Fri, 18 Jul 2008 04:00:40 +0000</pubDate>
		<dc:creator>Chris Cagle</dc:creator>
				<category><![CDATA[API]]></category>
		<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://www.cagintranet.com/?p=89</guid>
		<description><![CDATA[<a href="http://www.cagintranet.com/archive/creating-a-simple-php-application-using-the-flickr-api/"><img align="left" hspace="5" width="250" src="http://www.cagintranet.com/design/wp-content/uploads/2008/06/mainphoto.jpg" class="alignleft wp-post-image tfe" alt="" title="A Flickr API Tutorial" /></a>Photo Credit: *dans The Flickr API is one of the most widely used APIs out there. In this article I will show you how to build your own simple online application using PHP and the Flickr API. The sample online application we build today will be one that takes a Flickr image URL (e.g. http://www.flickr.com/photos/dans180/854998249/), [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.cagintranet.com/design/wp-content/uploads/2008/06/mainphoto.jpg" alt="" title="A Flickr API Tutorial" width="499" height="231" class="alignnone size-full wp-image-92" /></p>
<p><cite class="flickrcite"><br />
	Photo Credit: <a href="http://www.flickr.com/photos/dans180/854998249/">*dans</a><br />
</cite></p>
<p>The <a href="http://www.flickr.com/services/api/">Flickr API</a> is one of the most widely used APIs out there. In this article I will show you how to build your own simple online application using PHP and the Flickr API.</p>
<p>The sample online application we build today will be one that takes a Flickr image URL (e.g. <em>http://www.flickr.com/photos/dans180/854998249/</em>), then outputs the code needed for you to properly display the photo&#8217;s credit. Remember, every time you use a Creative Commons licensed photo from Flickr, you <a href="http://www.flickr.com/guidelines.gne">need to provide the proper attribution</a> and that is usually considered a link back to the photo while mentioning the photographer&#8217;s name. This is an example of the kind of output that we hope to get:</p>
<p><!--insert link-example here --></p>
<p><strong>Real Link: </strong><br />
Photo Credit: <a href="http://www.flickr.com/photos/dans180/854998249/">*dans</a></p>
<p><strong>HTML Code Output:</strong></p>
<pre><code class="html">Photo Credit: &lt;a href=&quot;http://www.flickr.com/photos/dans180/854998249/&quot;&gt;*dans&lt;/a&gt;</code></pre>
<h3>Getting Started</h3>
<p>First off, you will need to get an API key. <a href="http://www.flickr.com/services/api/keys/apply/">Get one here</a> and hold onto it for later.</p>
<p><img src="http://www.cagintranet.com/design/wp-content/uploads/2008/06/apikey.jpg" alt="" title="Get Your API Key" width="499" height="231" class="alignnone size-full wp-image-91" /></p>
<p>Next, we need to build the form that our visitors can input the URL into. This should be pretty basic stuff for most of us.</p>
<h3>The HTML Form</h3>
<p><!--insert form-code here --></p>
<pre><code class="html">&lt;form method=&quot;post&quot; id=&quot;form&quot; action=&quot;flickr_api_example.php&quot; &gt;
	&lt;table&gt;
		&lt;tr&gt;
		&lt;td&gt;&lt;label for=&quot;photo&quot;&gt;Flickr Photo URL:&lt;/label&gt;&lt;/td&gt;
		&lt;td&gt;&lt;input type=&quot;text&quot; value=&quot;&quot; size=&quot;50&quot; name=&quot;photo&quot; id=&quot;photo&quot; /&gt;&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
		&lt;td&gt;&lt;/td&gt;
		&lt;td&gt;&lt;input type=&quot;submit&quot; value=&quot;Generate Code&quot; name=&quot;submitted&quot; /&gt;&lt;/td&gt;
		&lt;/tr&gt;
	&lt;/table&gt;
&lt;/form&gt;</code></pre>
<h3>The PHP if-statement</h3>
<p>This form is setup to POST the data back to itself for processing. To handle this, we need to make use of an if-statement to check to see if the form is submitting data back to itself, or if it just needs to show a blank form to a new visitor. </p>
<p>The PHP evaluation <a href="http://us3.php.net/isset">isset</a> allows us to determine whether or not a variable is set. In our example, we check to see if the variable &#8216;<em>photo</em>&#8216; is set &#8211; because that is the name of the input field where the visitor enters the Flickr image&#8217;s URL.</p>
<p><!-- insert if-statement-setup here --></p>
<pre><code class="php">&lt;?php
if (isset($_POST[&#39;photo&#39;])) { //The form was submitted, process the data

} else { //The form was not submitted

};
?&gt;</code></pre>
<p>If the variable &#8216;<em>photo</em>&#8216; is set, the next step is to initialize some variables. The first variable is the image URL that the user submitted into our form, while the second will be the API key we got from Flickr.</p>
<p><!-- insert if-statement-variables here --></p>
<pre><code class="php">&lt;?php
if (isset($_POST[&#39;photo&#39;])) { //The form was submitted, process the data
	$queryString=$_POST[&#39;photo&#39;]; //The URL submitted
	$flickr_api_key = &quot;352ee7XXXXXXXXXXXXXXXXXXXXXXXXXX&quot;; //Our API Key

} else { //The form was not submitted

};
?&gt;</code></pre>
<p>In order to make the URL submitted usable to us, we need to split it up into its relevant sections. I use the PHP function <a href="http://us2.php.net/explode">explode</a> to help break the URL up by the character &#8216;/&#8217;. All we need from this URL is the photo id, and we can see below is the 6th of these so called sections.</p>
<p><em><strong>PHP FACT:</strong> PHP starts it&#8217;s count with 0.</em></p>
<p><img src="http://www.cagintranet.com/design/wp-content/uploads/2008/06/print_r-url.gif" alt="" title="print_r output of $url" width="500" height="153" class="alignnone size-full wp-image-90" /></p>
<p><!-- insert if-statement-spliturl here --></p>
<pre><code class="php">&lt;?php
if (isset($_POST[&#39;photo&#39;])) { //The form was submitted, process the data
	$queryString=$_POST[&#39;photo&#39;]; //The URL submitted
	$flickr_api_key = &quot;352ee7XXXXXXXXXXXXXXXXXXXXXXXXXX&quot;; //Our API Key

	$url = explode(&quot;/&quot;, $queryString); //Split the URL up into sections, delimited by the character '/'
	$photo_id = $url[5]; //The Photo ID is the 6th of these sections

} else { //The form was not submitted

};
?&gt;</code></pre>
<h3>Structuring the Flickr API</h3>
<p>After turning the contents of the <em>photo id</em> section into it&#8217;s own variable, we now have everything we need to start the API call. </p>
<p>After searching the Flickr site a while, I found the <a href="http://www.flickr.com/services/api/flickr.photos.getInfo.html">flickr.photos.getInfo</a> method &#8211; and judging by the example it displays, it looks to be exactly what we want. Notice we already have both of the required variables to make this call: <strong>$photo_id</strong> and <strong>$api_key</strong>. </p>
<p>Next, we need to find out what the correct call syntax that Flickr requires in order to get data back from their API. Luckily, they are nice enough to give us an <a href="http://www.flickr.com/services/api/response.php.html">example PHP call here</a>. This test gives us the insight needed as to what an API call should be structured like: </p>
<p><!-- insert if-statement-flickrapicall here --></p>
<p><strong>http://www.flickr.com/services/rest/?method=flickr.test.echo&#038;format=php_serial&#038;api_key=eaab5c513e33c01544385641ff9af42f</strong></p>
<p>After we modify their example to use the method <strong>flickr.photos.getInfo</strong>, we also need insert a new argument for the <em>photo_id</em>. Our newly structured API call now looks like this: <em>(changes are in red)</em></p>
<p><!-- insert if-statement-flickrapicall here --></p>
<p><strong>http://www.flickr.com/services/rest/?method=<em style="color:#cc0000;">flickr.photos.getInfo</em>&#038;format=php_serial<em style="color:#cc0000;">&#038;photo_id=$photo_id</em>&#038;api_key=<em style="color:#cc0000;">$flickr_api_key</em></strong></p>
<p>You can test the validity of our newly structured call by pasting it into any web browser&#8217;s address bar. You will get back real data if it works, or <a href="http://www.flickr.com/services/rest/?method=flickr.blogs.getList&#038;format=php_serial&#038;api_key=eaab5c513e33c01544385641ff9af42f">errors when it fails</a>.</p>
<h3>Using the Data from the Flickr API</h3>
<p>Once we get a working API call, we need to have our application read in the data that is returned. To import this data into our web app, we use the function <a href="http://us3.php.net/file_get_contents">file_get_contents</a>, then re-format it using the <a href="http://us3.php.net/manual/en/function.unserialize.php">unserialize function</a>. </p>
<p><!-- insert if-statement-flickrapicall here --></p>
<pre><code class="php">&lt;?php
if (isset($_POST[&#39;photo&#39;])) { //The form was submitted, process the data
	$queryString=$_POST[&#39;photo&#39;]; //The URL submitted
	$flickr_api_key = &quot;352ee7XXXXXXXXXXXXXXXXXXXXXXXXXX&quot;; //Our API Key

	$url = explode(&quot;/&quot;, $queryString); //Split the URL up into sections, delimited by the character/
	$photo_id = $url[5]; //The Photo ID is the 6th of these sections

	$flickrrawoutput =  file_get_contents(&quot;http://flickr.com/services/rest/?method=flickr.photos.getInfo&amp;photo_id=$photo_id&amp;api_key=$flickr_api_key&amp;format=php_serial&quot;);
	$flickroutput = unserialize($flickrrawoutput);

} else { //The form was not submitted

};
?&gt;</code></pre>
<p>Since all good coders do error checking, we also need to run a quick check to see if the API call returned no data (an error). We can do so with this simple line:</p>
<p><!-- insert if-statement-flickrerrorline here --></p>
<pre><code class="php">$status = $flickroutput[&#39;stat&#39;]; //Extracts the &#39;stat&#39; value from the data returned</code></pre>
<p>Now, with a second if-statement, we check to see the variable <strong>$status</strong>&#8216;s value, and if it doesn&#8217;t contain the word &#8216;<em>fail</em>&#8216; then we know we made a successful call. Putting it all together, it looks like this:</p>
<p><!-- insert if-statement-flickrsecondif here --></p>
<pre><code class="php">&lt;?php
if (isset($_POST[&#39;photo&#39;])) { //The form was submitted, process the data
	$queryString=$_POST[&#39;photo&#39;]; //The URL submitted
	$flickr_api_key = &quot;352ee7XXXXXXXXXXXXXXXXXXXXXXXXXX&quot;; //Our API Key

	$url = explode(&quot;/&quot;, $queryString); //Split the URL up into sections, delimited by the character/
	$photo_id = $url[5]; //The Photo ID is the 6th of these sections

	//Get the data from Flickr
	$flickrrawoutput =  file_get_contents(&quot;http://flickr.com/services/rest/?method=flickr.photos.getInfo&amp;photo_id=$photo_id&amp;api_key=$flickr_api_key&amp;format=php_serial&quot;);
	$flickroutput = unserialize($flickrrawoutput); 

	$status = $flickroutput[&#39;stat&#39;]; //Extracts the &#39;stat&#39; value from the data returned

	if ($status != &#39;fail&#39;) { //fetch from Flickr returned stats for photo

	} else {
		echo &quot;The supplied photo URL is wrong. Please &lt;a href=\&quot;#form\&quot;&gt;try again&lt;/a&gt;.&quot;; //A bad URL was entered into the form
	};

} else { //The form was not submitted

};
?&gt;</code></pre>
<p>Once we know we&#8217;ve made a successful API call, we need to extract the &#8216;<em>username</em>&#8216; of the photo&#8217;s owner. We do this with this line:</p>
<p><!-- insert flickr-extract-data --></p>
<pre><code class="php">$flickr_user  = $flickroutput[&#39;photo&#39;][&#39;owner&#39;][&#39;username&#39;];</code></pre>
<p>&#8230; but this is sometimes not an easy thing to figure out. I have found the best way to find out what to extract is by analyzing the unserialized data we get back from Flickr. PHP allows us to look at the data in an easier to read format by using <a href="http://us3.php.net/manual/en/function.print-r.php">print_r</a>.</p>
<p><!-- insert flickr-print_r --></p>
<pre><code class="php">print_r ($flickroutput)</code></pre>
<p>This is probably the hardest part of using the API. If you insert the <em>print_r</em> command into your PHP document right after we unserialize the Flickr data, we can easily see the different levels of the data structure. </p>
<p><em>Hint: You can view the output of <a href="http://www.cagintranet.com/design/wp-content/uploads/2008/06/print_r.php">our print_r command here</a>. The different tiers are highlighted in red.</em></p>
<p>The way our data extract works is &#8216;photo&#8217; is the first level within the <strong>$flickroutput</strong> data. The next tier down is &#8216;owner&#8217;, which houses the last level called &#8216;username&#8217; which holds the data we need. That&#8217;s how we get <strong>$flickroutput['photo']['owner']['username']</strong> &#8212; each [] is referencing it&#8217;s own tier.</p>
<h3>Output the Data to the Visitor</h3>
<p>Once we have the <strong>$flickr_user</strong> variable set with this extract, we are ready to output our finished code. We will output it twice: One as an example &#8220;live&#8221; link, and the other will be the raw HTML code that the visitor can input into his or her site. </p>
<p><!-- insert if-statement-final here --></p>
<pre><code class="php">&lt;?php
if (isset($_POST[&#39;photo&#39;])) { //The form was submitted, process the data
	$queryString=$_POST[&#39;photo&#39;]; //The URL submitted
	$flickr_api_key = &quot;352ee7XXXXXXXXXXXXXXXXXXXXXXXXXX&quot;; //Our API Key

	$url = explode(&quot;/&quot;, $queryString); //Split the URL up into sections, delimited by the character/
	$photo_id = $url[5]; //The Photo ID is the 6th of these sections

	//Get the data from Flickr
	$flickrrawoutput =  file_get_contents(&quot;http://flickr.com/services/rest/?method=flickr.photos.getInfo&amp;photo_id=$photo_id&amp;api_key=$flickr_api_key&amp;format=php_serial&quot;);
	$flickroutput = unserialize($flickrrawoutput); 

	$status = $flickroutput[&#39;stat&#39;]; //Extracts the &#39;stat&#39; value from the data returned

	if ($status != &#39;fail&#39;) { //fetch from Flickr returned stats for photo
		$flickr_user  = $flickroutput[&#39;photo&#39;][&#39;owner&#39;][&#39;username&#39;];
	?&gt;

	&lt;p&gt;Preview: &lt;/p&gt;
	&lt;cite&gt;Photo Credit: &lt;a href=&quot;&lt;?php echo $queryString; ?&gt;&quot; title=&quot;Photo Credit: &lt;?php echo $flickr_user; ?&gt;&quot;&gt;&lt;?php echo $flickr_user; ?&gt;&lt;/a&gt;&lt;/cite&gt;&lt;/p&gt;
	&lt;p&gt;HTML Code:&lt;/p&gt;
	&lt;pre&gt;
		&amp;lt;cite&amp;gt;
			Photo Credit: &amp;lt;a href=&amp;quot;&lt;?php echo $queryString; ?&gt;&amp;quot; title=&amp;quot;Photo Credit: &lt;?php echo $flickr_user; ?&gt;&amp;quot;&amp;gt;&lt;?php echo $flickr_user; ?&gt;&amp;lt;/a&amp;gt;
		&amp;lt;/cite&amp;gt;
	&lt;/pre&gt;

	&lt;?php
	} else {
		echo &quot;The supplied photo URL is wrong. Please &lt;a href=\&quot;#form\&quot;&gt;try again&lt;/a&gt;.&quot;; //A bad URL was entered into the form
	};

} else { //The form was not submitted

};
?&gt;</code></pre>
<h3>Putting it all Together</h3>
<p>Now that we have the form and the PHP sections completed, we need to put it all together into an application page. You can download the <a href="http://www.cagintranet.com/design/wp-content/uploads/2008/06/flickr_api_example.phps">example page here</a>, or you can take a look at the <a href="http://www.cagintranet.com/code/flickrcite/">working example I&#8217;ve put up</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cagintranet.com/archive/creating-a-simple-php-application-using-the-flickr-api/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>CSS Tip: Easy Cross Browser &amp; Valid CSS Text Shadows</title>
		<link>http://www.cagintranet.com/archive/css-tip-easy-cross-browser-valid-css-text-shadows/</link>
		<comments>http://www.cagintranet.com/archive/css-tip-easy-cross-browser-valid-css-text-shadows/#comments</comments>
		<pubDate>Sun, 22 Jun 2008 13:42:49 +0000</pubDate>
		<dc:creator>Chris Cagle</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://www.cagintranet.com/?p=84</guid>
		<description><![CDATA[<a href="http://www.cagintranet.com/archive/css-tip-easy-cross-browser-valid-css-text-shadows/"><img align="left" hspace="5" width="250" src="http://www.cagintranet.com/design/wp-content/uploads/2008/06/cssshadow.png" class="alignleft wp-post-image tfe" alt="" title="CSS Text Shadows" /></a>Photo Credit: Glockenblume Although I am certain that I am not the only one doing this, I have developed an extremely easy way to get CSS text shadows without the need to use the wildly unsupported CSS property of text-shadow. .post_title { position:relative; padding:10px 0 0 0; } .post_title h1 { position:absolute; top:2px; left:2px; font-size:30px; [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.cagintranet.com/design/wp-content/uploads/2008/06/cssshadow.png" alt="" title="CSS Text Shadows" width="500" height="200" class="alignnone size-full wp-image-85" /></p>
<p><cite class="flickrcite" >Photo Credit: <a href="http://www.flickr.com/photos/glockenblume/">Glockenblume</a></cite></p>
<p>Although I am certain that I am not the only one doing this, I have developed an extremely easy way to get CSS text shadows without the need to use the wildly unsupported CSS property of <a href="http://www.quirksmode.org/css/textshadow.html">text-shadow</a>.</p>
<style type="text/css">
.post_title {
position:relative;
padding:10px 0 0 0;
}</p>
<p>.post_title h1 {
position:absolute;
top:2px;
left:2px;
font-size:30px;
color:#C9D8E9;
padding:0;
margin:0;
}</p>
<p>.post_title h6 {
position:absolute;
top:0;
left:0;
font-size:30px;
color:#4471A2;
padding:0;
margin:0;
}</p>
</style>
<div class="post_title">
<h1>Lorem ipsum dolor sit amet consectetuer</h1>
<h6>Lorem ipsum dolor sit amet consectetuer</h6>
<p>&nbsp;</p>
<div class="clear"></div>
</div>
<p>The only problem that some people may see with this example is &#8220;duplicate content&#8221; because the title is shown twice in the HTML. I&#8217;ve decided that sometimes when all you need is a simple text drop shadow, this is an acceptable problem. This technique is extremely easy, and I have used it on a couple sites of mine thus far with no cross-browser issues. </p>
<h3>The Code (HTML)</h3>
<pre><code class="html">&lt;div class=&quot;post_title&quot;&gt;
	&lt;h1&gt;Lorem ipsum dolor sit amet consectetuer&lt;/h1&gt;
	&lt;h6&gt;Lorem ipsum dolor sit amet consectetuer&lt;/h6&gt;
&lt;/div&gt;</code></pre>
<h3>The Code (CSS)</h3>
<pre><code class="css">.post_title {
position:relative;
font-family:arial;
}

.post_title h1 {
position:absolute;
top:2px;
left:2px;
font-size:30px;
color:#C9D8E9;
padding:0;
margin:0;
}

.post_title h6 {
position:absolute;
top:0;
left:0;
font-size:30px;
color:#4471A2;
padding:0;
margin:0;
}</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://www.cagintranet.com/archive/css-tip-easy-cross-browser-valid-css-text-shadows/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
	</channel>
</rss>
