<?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>A Better Way &#187; PHP</title>
	<atom:link href="http://www.thejacklawson.com/index.php/tag/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.thejacklawson.com</link>
	<description>Finding a better way to get things done, a technical journey</description>
	<lastBuildDate>Tue, 24 Aug 2010 21:10:10 +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>HTML5 Site – Waterford Family Bowl (Part 3 of n)</title>
		<link>http://www.thejacklawson.com/index.php/2010/05/html5-site-waterford-family-bowl-part-3/</link>
		<comments>http://www.thejacklawson.com/index.php/2010/05/html5-site-waterford-family-bowl-part-3/#comments</comments>
		<pubDate>Tue, 04 May 2010 16:30:13 +0000</pubDate>
		<dc:creator>Jack Lawson</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Google]]></category>
		<category><![CDATA[JQuery]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Atom]]></category>
		<category><![CDATA[Cascading Style Sheets]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[RSS]]></category>
		<category><![CDATA[Simplepie]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://www.thejacklawson.com/?p=230</guid>
		<description><![CDATA[Image via Wikipedia (Back to beginning of series) Part 3: Site Architecture Design Now that I had the majority of the HTML and CSS down, I had more to figure out about how to implement the various features (like image gallery, news,and mailing list). Should I write my own, or should I use existing tools? What language should [...]]]></description>
			<content:encoded><![CDATA[<div class="zemanta-img" style="margin: 1em; display: block;">
<div>
<dl class="wp-caption alignright" style="width: 138px;">
<dt class="wp-caption-dt"><a href="http://commons.wikipedia.org/wiki/Image:Feed-icon.svg"><img title="This icon, known as the &quot;feed icon&quot; ..." src="http://upload.wikimedia.org/wikipedia/commons/thumb/4/43/Feed-icon.svg/128px-Feed-icon.svg.png" alt="This icon, known as the &quot;feed icon&quot; ..." width="128" height="128" /></a></dt>
<dd class="wp-caption-dd zemanta-img-attribution" style="font-size: 0.8em;">Image via <a href="http://commons.wikipedia.org/wiki/Image:Feed-icon.svg">Wikipedia</a></dd>
</dl>
</div>
</div>
<p>(<a href="http://www.thejacklawson.com/index.php/2010/04/html5-site-waterford-family-bowl-part-1-of-n/">Back to beginning of series</a>)</p>
<p>Part 3: Site Architecture Design</p>
<p>Now that I had the majority of the HTML and CSS down, I had more to figure out about how to implement the various features (like image gallery, news,and mailing list). Should I write my own, or should I use existing tools? What language should I use? What database system? Which pages should be static, which dynamic? The process of building he site was all about efficiency: getting the most done, using the best tools, in the least amount of time. That would allow me to focus as much time as possible in my before my deadline towards the things that will make a difference: site design, usability, and the the use of the features on the site.</p>
<p>I came with the conclusion that I could, and should, develop most of the data management using external tools. Spending time re-inventing the wheel and rebuilding tools that already have dedicated teams would be wasteful, especially when they all had some sort of hook (mostly RSS feeds) that I could just pull into the site. I was familiar with all the 3rd party tools I needed, so I was already comfortable with using them and knew they had the features that I needed. I came up with:</p>
<ul>
<li><a href="http://www.google.com/apps/intl/en/business/index.html" target="_blank">Google Apps</a> for email and calendar
<ul>
<li><a href="http://om4.com.au/client/embedding-google-apps-calendar/" target="_blank">Here&#8217;s a good tutorial</a>. It was a little messy at first, but it gives you an iframe (the only standards-breaking thing on the site&#8230; thanks, Goog) that you can just drop in.</li>
</ul>
</li>
<li><a href="http://picasa.google.com/" target="_blank">Picasa</a> for photo gallery
<ul>
<li>I chose Picasa for a few reasons, the largest of which was the integration of the Google Apps account. While there&#8217;s no &#8220;Picasa&#8221; section of Google Apps, I could use the account I set up to minimize the logins I&#8217;m using, now that I&#8217;m using four tools. I used the RSS feed to export to the image gallery and to make an image gallery  RSS link on the home page.</li>
</ul>
</li>
<li><a href="http://wordpress.org/" target="_blank">WordPress</a> for dynamic pages and news
<ul>
<li>The reason I used WordPress, and I didn&#8217;t just slap together my own editor, was the <a href="http://wordpress.org/extend/plugins/page-feeder/" target="_blank">WCM Page Feeder</a> plugin. It allows you to serve individual WordPress pages as an RSS feed. This means that I could use WP&#8217;s superior news-serving tools along with their page editing tools with very simple integration. I also added an RSS link to the home page, for news.</li>
</ul>
</li>
<li><a href="http://pommo.org/Main_Page" target="_blank">Pommo</a> for mailing list management
<ul>
<li>I tried out a few tools, and found this to be the easiest to set up. Makes adding an email form pretty simple, manages everything for me. Another several hours saved to these guys. Here&#8217;s some credit <img src='http://www.thejacklawson.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </li>
</ul>
</li>
</ul>
<p>I also used a couple 3rd party PHP Libraries so that I could hook all of this lovliness together:</p>
<ul>
<li><a href="http://simplepie.org/" target="_blank">Simplepie</a> RSS Reader
<ul>
<li>Note: I had to switch my WordPress RSS feeds over to Atom, even though SP claims it can read the RSS 2.0 standard. This was a simple checkbox in the &#8220;Writing&#8221; section of the WordPress settings.</li>
</ul>
</li>
<li>phpmailer for mail functions
<ul>
<li>A little messy to set up to go through Google Apps mail. I had to set <a href="http://pastebin.com/GDP5XKCq" target="_blank">these settings</a> in class.phpmailer.php in order to connect without errors. Once you have this part right, though, you&#8217;re good to go. I&#8217;ll go into more detail about this in the next article.</li>
</ul>
</li>
</ul>
<p>Once all of these tools were in place, it was a simple matter of dumping their content, using Simplepie, into my template. I&#8217;ll talk about the actual hooking up of everything, and setting up the custom code I did write, in the next article.</p>
<div class="zemanta-pixie" style="margin-top: 10px; height: 15px;"><a class="zemanta-pixie-a" title="Reblog this post [with Zemanta]" href="http://reblog.zemanta.com/zemified/f9e4b859-6bc3-4877-814b-f8ba4e564441/"><img class="zemanta-pixie-img" style="border: none; float: right;" src="http://img.zemanta.com/reblog_e.png?x-id=f9e4b859-6bc3-4877-814b-f8ba4e564441" alt="Reblog this post [with Zemanta]" /></a><span class="zem-script more-related pretty-attribution"><script src="http://static.zemanta.com/readside/loader.js" type="text/javascript"></script></span></div>
<!-- Social Bookmarking Reloaded BEGIN --><div class="social_bookmark"><em> </em><br /><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http://www.thejacklawson.com/index.php/2010/05/html5-site-waterford-family-bowl-part-3/&amp;title=HTML5+Site+%E2%80%93+Waterford+Family+Bowl+%28Part+3+of+n%29" title="Add 'HTML5 Site – Waterford Family Bowl (Part 3 of n)' to Del.icio.us"><img src="http://www.thejacklawson.com/wp-content/plugins/social-bookmarking-reloaded/delicious.png" title="Add 'HTML5 Site – Waterford Family Bowl (Part 3 of n)' to Del.icio.us" alt="Add 'HTML5 Site – Waterford Family Bowl (Part 3 of n)' to Del.icio.us" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http://www.thejacklawson.com/index.php/2010/05/html5-site-waterford-family-bowl-part-3/&amp;title=HTML5+Site+%E2%80%93+Waterford+Family+Bowl+%28Part+3+of+n%29" title="Add 'HTML5 Site – Waterford Family Bowl (Part 3 of n)' to digg"><img src="http://www.thejacklawson.com/wp-content/plugins/social-bookmarking-reloaded/digg.png" title="Add 'HTML5 Site – Waterford Family Bowl (Part 3 of n)' to digg" alt="Add 'HTML5 Site – Waterford Family Bowl (Part 3 of n)' to digg" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://reddit.com/submit?url=http://www.thejacklawson.com/index.php/2010/05/html5-site-waterford-family-bowl-part-3/&amp;title=HTML5+Site+%E2%80%93+Waterford+Family+Bowl+%28Part+3+of+n%29" title="Add 'HTML5 Site – Waterford Family Bowl (Part 3 of n)' to reddit"><img src="http://www.thejacklawson.com/wp-content/plugins/social-bookmarking-reloaded/reddit.png" title="Add 'HTML5 Site – Waterford Family Bowl (Part 3 of n)' to reddit" alt="Add 'HTML5 Site – Waterford Family Bowl (Part 3 of n)' to reddit" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http://www.thejacklawson.com/index.php/2010/05/html5-site-waterford-family-bowl-part-3/" title="Add 'HTML5 Site – Waterford Family Bowl (Part 3 of n)' to Technorati"><img src="http://www.thejacklawson.com/wp-content/plugins/social-bookmarking-reloaded/technorati.png" title="Add 'HTML5 Site – Waterford Family Bowl (Part 3 of n)' to Technorati" alt="Add 'HTML5 Site – Waterford Family Bowl (Part 3 of n)' to Technorati" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.newsvine.com/_wine/save?u=http://www.thejacklawson.com/index.php/2010/05/html5-site-waterford-family-bowl-part-3/&amp;h=HTML5+Site+%E2%80%93+Waterford+Family+Bowl+%28Part+3+of+n%29" title="Add 'HTML5 Site – Waterford Family Bowl (Part 3 of n)' to Newsvine"><img src="http://www.thejacklawson.com/wp-content/plugins/social-bookmarking-reloaded/newsvine.png" title="Add 'HTML5 Site – Waterford Family Bowl (Part 3 of n)' to Newsvine" alt="Add 'HTML5 Site – Waterford Family Bowl (Part 3 of n)' to Newsvine" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit?url=http://www.thejacklawson.com/index.php/2010/05/html5-site-waterford-family-bowl-part-3/&amp;title=HTML5+Site+%E2%80%93+Waterford+Family+Bowl+%28Part+3+of+n%29" title="Add 'HTML5 Site – Waterford Family Bowl (Part 3 of n)' to Stumble Upon"><img src="http://www.thejacklawson.com/wp-content/plugins/social-bookmarking-reloaded/stumbleupon.png" title="Add 'HTML5 Site – Waterford Family Bowl (Part 3 of n)' to Stumble Upon" alt="Add 'HTML5 Site – Waterford Family Bowl (Part 3 of n)' to Stumble Upon" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http://www.thejacklawson.com/index.php/2010/05/html5-site-waterford-family-bowl-part-3/&amp;title=HTML5+Site+%E2%80%93+Waterford+Family+Bowl+%28Part+3+of+n%29" title="Add 'HTML5 Site – Waterford Family Bowl (Part 3 of n)' to Google Bookmarks"><img src="http://www.thejacklawson.com/wp-content/plugins/social-bookmarking-reloaded/google.png" title="Add 'HTML5 Site – Waterford Family Bowl (Part 3 of n)' to Google Bookmarks" alt="Add 'HTML5 Site – Waterford Family Bowl (Part 3 of n)' to Google Bookmarks" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="https://favorites.live.com/quickadd.aspx?url=http://www.thejacklawson.com/index.php/2010/05/html5-site-waterford-family-bowl-part-3/&amp;title=HTML5+Site+%E2%80%93+Waterford+Family+Bowl+%28Part+3+of+n%29" title="Add 'HTML5 Site – Waterford Family Bowl (Part 3 of n)' to Live-MSN"><img src="http://www.thejacklawson.com/wp-content/plugins/social-bookmarking-reloaded/live.png" title="Add 'HTML5 Site – Waterford Family Bowl (Part 3 of n)' to Live-MSN" alt="Add 'HTML5 Site – Waterford Family Bowl (Part 3 of n)' to Live-MSN" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://slashdot.org/bookmark.pl?title=HTML5+Site+%E2%80%93+Waterford+Family+Bowl+%28Part+3+of+n%29&amp;url=http://www.thejacklawson.com/index.php/2010/05/html5-site-waterford-family-bowl-part-3/" title="Add 'HTML5 Site – Waterford Family Bowl (Part 3 of n)' to SlashDot"><img src="http://www.thejacklawson.com/wp-content/plugins/social-bookmarking-reloaded/slashdot.png" title="Add 'HTML5 Site – Waterford Family Bowl (Part 3 of n)' to SlashDot" alt="Add 'HTML5 Site – Waterford Family Bowl (Part 3 of n)' to SlashDot" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/share.php?u=http://www.thejacklawson.com/index.php/2010/05/html5-site-waterford-family-bowl-part-3/&amp;t=HTML5+Site+%E2%80%93+Waterford+Family+Bowl+%28Part+3+of+n%29" title="Add 'HTML5 Site – Waterford Family Bowl (Part 3 of n)' to FaceBook"><img src="http://www.thejacklawson.com/wp-content/plugins/social-bookmarking-reloaded/facebook.png" title="Add 'HTML5 Site – Waterford Family Bowl (Part 3 of n)' to FaceBook" alt="Add 'HTML5 Site – Waterford Family Bowl (Part 3 of n)' to FaceBook" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://twitter.com/home?status=http://www.thejacklawson.com/index.php/2010/05/html5-site-waterford-family-bowl-part-3/" title="Add 'HTML5 Site – Waterford Family Bowl (Part 3 of n)' to Twitter"><img src="http://www.thejacklawson.com/wp-content/plugins/social-bookmarking-reloaded/twitter.png" title="Add 'HTML5 Site – Waterford Family Bowl (Part 3 of n)' to Twitter" alt="Add 'HTML5 Site – Waterford Family Bowl (Part 3 of n)' to Twitter" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/reader/link?url=http://www.thejacklawson.com/index.php/2010/05/html5-site-waterford-family-bowl-part-3/&amp;title=HTML5+Site+%E2%80%93+Waterford+Family+Bowl+%28Part+3+of+n%29&amp;srcURL=http://www.thejacklawson.com/index.php/2010/05/html5-site-waterford-family-bowl-part-3/" title="Add 'HTML5 Site – Waterford Family Bowl (Part 3 of n)' to Google Buzz"><img src="http://www.thejacklawson.com/wp-content/plugins/social-bookmarking-reloaded/googlebuzz.png" title="Add 'HTML5 Site – Waterford Family Bowl (Part 3 of n)' to Google Buzz" alt="Add 'HTML5 Site – Waterford Family Bowl (Part 3 of n)' to Google Buzz" /></a></div>
<!-- Social Bookmarking Reloaded END -->]]></content:encoded>
			<wfw:commentRss>http://www.thejacklawson.com/index.php/2010/05/html5-site-waterford-family-bowl-part-3/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>n-Tiered AJAX</title>
		<link>http://www.thejacklawson.com/index.php/2008/02/n-tiered-ajax/</link>
		<comments>http://www.thejacklawson.com/index.php/2008/02/n-tiered-ajax/#comments</comments>
		<pubDate>Mon, 04 Feb 2008 18:39:06 +0000</pubDate>
		<dc:creator>Jack</dc:creator>
				<category><![CDATA[Architecture]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Web Design]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://www.thejacklawson.com/?p=5</guid>
		<description><![CDATA[
]]></description>
			<content:encoded><![CDATA[<p><span style="font-style: italic;">n</span>-Tiered AJAX is one of my my<br />
favorite development architectures. It&#8217;s how I developed Gevalum, and<br />
it&#8217;s how I&#8217;ll develop every website to come that has to touch a<br />
database, but doesn&#8217;t require a full-scale ASP.NET application<br />
platform. It&#8217;s fast, it&#8217;s scalable, and in the end, you&#8217;ve got one<br />
sweet site with amazing processing efficiency and <span style="font-style: italic;">pizazz</span>. It&#8217;s a pretty simple idea. This is how I develop:</p>
<p>First<br />
off: make a mockup of the design. Figure out what you want it to look<br />
like; draw it up in Photoshop, or write up the CSS in notepad, or<br />
however you&#8217;re doing what you do. Make a note of every bit of static<br />
information, and every bit of dynamic information, and dump it all into<br />
DIV tags.</p>
<p>Next, after the interface tier, comes the big part:<br />
your JavaScript tier. There are three distinct parts to this, although<br />
you may only require two.</p>
<p>Part 1: your object layer. If you have<br />
things like I do (players, items, etc) you&#8217;ll want to make objects. An<br />
example would be a player object, with player.strength, player.health,<br />
player.level, player.name&#8230; etc. A variable for every bit of connected<br />
information on your page.</p>
<p>Part 2: your update layer. Make a<br />
library of functions for each bit of information that you update. Don&#8217;t<br />
directly call the AJAX here; update the objects you made, or use these<br />
as a wrapper to validate then call your AJAX functions. You&#8217;ll probably<br />
want to include some DOM functions like:</p>
<p>function $(div){<br />   return document.getElementById(div);<br />}</p>
<p>and interface updater functions like:</p>
<p>function updateStats(){<br />   $(&#8220;playerStr&#8221;).innerHTML = player.str;<br />   //etc for all other stats<br />}</p>
<p>and variable updater functions like:</p>
<p>function uSTR(newStr){<br />   player.str = newStr<br />}<br />and<br />
anything else that your page does. Try to keep everything seperated; at<br />
a minimum, I always have a dom.js, functions.js, and then finally<br />
AJAX.js. You&#8217;ll call your AJAX layer by using something like this:</p>
<p>function uSTR(){<br />   player.str = evalAJAXPost(&#8220;playerstats.php?stat=str&#8221;);<br />}</p>
<p>Part<br />
3: Your AJAX layer. These are the functions that use your server-side<br />
pages. You always want to separate these because they&#8217;re things you use<br />
over, and over, and over again. Another trick that I learned a while<br />
ago, is that if you have simultaneous updates (e.g. sending dynamic<br />
updates while requesting pages), make an array of AJAX objects, and<br />
pass each page request through a different object. I&#8217;ve found that<br />
there&#8217;s no need for more than two or three (even Gevalum only has<br />
seven, and that&#8217;s probably overkill.) This is an excerpt from Gevalum&#8217;s<br />
AJAXFun.js:</p>
<p>var ajaxes = new Array();<br />//if we&#8217;re FF<br />if(window.XMLHttpRequest){<br />   ajaxes[0] = new XMLHttpRequest();<br />   ajaxes[1] = new XMLHttpRequest();<br />       ajaxes[2] = new XMLHttpRequest();<br />      ajaxes[3] = new XMLHttpRequest();<br />      ajaxes[4] = new XMLHttpRequest();<br />      ajaxes[5] = new XMLHttpRequest();<br />      ajaxes[6] = new XMLHttpRequest();<br />//or, if we&#8217;re IE<br />}else if(window.ActiveXObject){<br />       ajaxes[0] = new ActiveXObject(&#8220;Microsoft.XMLHTTP&#8221;);<br />      ajaxes[1] = new ActiveXObject(&#8220;Microsoft.XMLHTTP&#8221;);<br />      ajaxes[2] = new ActiveXObject(&#8220;Microsoft.XMLHTTP&#8221;);<br />      ajaxes[3] = new ActiveXObject(&#8220;Microsoft.XMLHTTP&#8221;);<br />      ajaxes[4] = new ActiveXObject(&#8220;Microsoft.XMLHTTP&#8221;);<br />      ajaxes[5] = new ActiveXObject(&#8220;Microsoft.XMLHTTP&#8221;);<br />      ajaxes[6] = new ActiveXObject(&#8220;Microsoft.XMLHTTP&#8221;);<br />}</p>
<p>function evalAJAXHtml(source,nr){<br />       ajaxes[nr].open(&#8220;GET&#8221;,source,true);<br />      ajaxes[nr].onreadystatechange = function(){<br />             try{<br />                       if(ajaxes[nr].readyState==4){<br />                               if (ajaxes[nr].status == 200){<br />                                       eval(ajaxes[nr].responseText);<br />                               }<br />                       }<br />               }<br />               catch(e){<br />                       //Exception-bug in FF<br />       }<br />      }<br />       ajaxes[nr].send(null);<br />}</p>
<p>function evalpostAJAXHtml(source,datan,nr){<br />       ajaxes[nr].open(&#8220;POST&#8221;,source,true);<br />       ajaxes[nr].setRequestHeader(&#8220;Content-type&#8221;, &#8220;application/x-www-form-urlencoded&#8221;);<br />       ajaxes[nr].setRequestHeader(&#8220;Content-length&#8221;, datan.length);<br />       ajaxes[nr].setRequestHeader(&#8220;Connection&#8221;, &#8220;close&#8221;);<br />       ajaxes[nr].onreadystatechange = function(){<br />               try{<br />                      if(ajaxes[nr].readyState==4){<br />                               if (ajaxes[nr].status == 200){<br />                                       eval(ajaxes[nr].responseText);<br />                               }<br />                       }<br />               }<br />               catch(e){<br />                       //Exception-bug in FF<br />               }<br />       }<br />       ajaxes[nr].send(datan);<br />}</p>
<p>Now,<br />
for the server-side part of this AJAX tiered application. There are a<br />
thousand ways to do this, depending on personal taste; I choose PHP,<br />
since it&#8217;s lightweight. You could use ruby, or asp, or asp.net, or<br />
anything that outputs text. All I have to do is pull the information I<br />
need, and write out my JavaScript updater function, and I&#8217;m done.</p>
<p>You<br />
may be asking: why bother? Well, the easiest is that it&#8217;s the absolute<br />
fastest way to get information securely from a database to the client.<br />
It sends the minimum information possible, and so saves you bandwidth.<br />
It&#8217;s invaluable for a little hosted server, or if you&#8217;re hosting<br />
yourself and can&#8217;t afford a business-class internet line. Not to<br />
mention, it&#8217;s faster on the user&#8217;s end, so they wait less, making them<br />
less likely to turn away from some lag-o-licious old monolith of a<br />
website. It&#8217;s streamlined, it&#8217;s dynamic; what else could you ask for?</p>
<!-- Social Bookmarking Reloaded BEGIN --><div class="social_bookmark"><em> </em><br /><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http://www.thejacklawson.com/index.php/2008/02/n-tiered-ajax/&amp;title=n-Tiered+AJAX" title="Add 'n-Tiered AJAX' to Del.icio.us"><img src="http://www.thejacklawson.com/wp-content/plugins/social-bookmarking-reloaded/delicious.png" title="Add 'n-Tiered AJAX' to Del.icio.us" alt="Add 'n-Tiered AJAX' to Del.icio.us" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http://www.thejacklawson.com/index.php/2008/02/n-tiered-ajax/&amp;title=n-Tiered+AJAX" title="Add 'n-Tiered AJAX' to digg"><img src="http://www.thejacklawson.com/wp-content/plugins/social-bookmarking-reloaded/digg.png" title="Add 'n-Tiered AJAX' to digg" alt="Add 'n-Tiered AJAX' to digg" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://reddit.com/submit?url=http://www.thejacklawson.com/index.php/2008/02/n-tiered-ajax/&amp;title=n-Tiered+AJAX" title="Add 'n-Tiered AJAX' to reddit"><img src="http://www.thejacklawson.com/wp-content/plugins/social-bookmarking-reloaded/reddit.png" title="Add 'n-Tiered AJAX' to reddit" alt="Add 'n-Tiered AJAX' to reddit" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http://www.thejacklawson.com/index.php/2008/02/n-tiered-ajax/" title="Add 'n-Tiered AJAX' to Technorati"><img src="http://www.thejacklawson.com/wp-content/plugins/social-bookmarking-reloaded/technorati.png" title="Add 'n-Tiered AJAX' to Technorati" alt="Add 'n-Tiered AJAX' to Technorati" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.newsvine.com/_wine/save?u=http://www.thejacklawson.com/index.php/2008/02/n-tiered-ajax/&amp;h=n-Tiered+AJAX" title="Add 'n-Tiered AJAX' to Newsvine"><img src="http://www.thejacklawson.com/wp-content/plugins/social-bookmarking-reloaded/newsvine.png" title="Add 'n-Tiered AJAX' to Newsvine" alt="Add 'n-Tiered AJAX' to Newsvine" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit?url=http://www.thejacklawson.com/index.php/2008/02/n-tiered-ajax/&amp;title=n-Tiered+AJAX" title="Add 'n-Tiered AJAX' to Stumble Upon"><img src="http://www.thejacklawson.com/wp-content/plugins/social-bookmarking-reloaded/stumbleupon.png" title="Add 'n-Tiered AJAX' to Stumble Upon" alt="Add 'n-Tiered AJAX' to Stumble Upon" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http://www.thejacklawson.com/index.php/2008/02/n-tiered-ajax/&amp;title=n-Tiered+AJAX" title="Add 'n-Tiered AJAX' to Google Bookmarks"><img src="http://www.thejacklawson.com/wp-content/plugins/social-bookmarking-reloaded/google.png" title="Add 'n-Tiered AJAX' to Google Bookmarks" alt="Add 'n-Tiered AJAX' to Google Bookmarks" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="https://favorites.live.com/quickadd.aspx?url=http://www.thejacklawson.com/index.php/2008/02/n-tiered-ajax/&amp;title=n-Tiered+AJAX" title="Add 'n-Tiered AJAX' to Live-MSN"><img src="http://www.thejacklawson.com/wp-content/plugins/social-bookmarking-reloaded/live.png" title="Add 'n-Tiered AJAX' to Live-MSN" alt="Add 'n-Tiered AJAX' to Live-MSN" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://slashdot.org/bookmark.pl?title=n-Tiered+AJAX&amp;url=http://www.thejacklawson.com/index.php/2008/02/n-tiered-ajax/" title="Add 'n-Tiered AJAX' to SlashDot"><img src="http://www.thejacklawson.com/wp-content/plugins/social-bookmarking-reloaded/slashdot.png" title="Add 'n-Tiered AJAX' to SlashDot" alt="Add 'n-Tiered AJAX' to SlashDot" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/share.php?u=http://www.thejacklawson.com/index.php/2008/02/n-tiered-ajax/&amp;t=n-Tiered+AJAX" title="Add 'n-Tiered AJAX' to FaceBook"><img src="http://www.thejacklawson.com/wp-content/plugins/social-bookmarking-reloaded/facebook.png" title="Add 'n-Tiered AJAX' to FaceBook" alt="Add 'n-Tiered AJAX' to FaceBook" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://twitter.com/home?status=http://www.thejacklawson.com/index.php/2008/02/n-tiered-ajax/" title="Add 'n-Tiered AJAX' to Twitter"><img src="http://www.thejacklawson.com/wp-content/plugins/social-bookmarking-reloaded/twitter.png" title="Add 'n-Tiered AJAX' to Twitter" alt="Add 'n-Tiered AJAX' to Twitter" /></a><a class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,border=0,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/reader/link?url=http://www.thejacklawson.com/index.php/2008/02/n-tiered-ajax/&amp;title=n-Tiered+AJAX&amp;srcURL=http://www.thejacklawson.com/index.php/2008/02/n-tiered-ajax/" title="Add 'n-Tiered AJAX' to Google Buzz"><img src="http://www.thejacklawson.com/wp-content/plugins/social-bookmarking-reloaded/googlebuzz.png" title="Add 'n-Tiered AJAX' to Google Buzz" alt="Add 'n-Tiered AJAX' to Google Buzz" /></a></div>
<!-- Social Bookmarking Reloaded END -->]]></content:encoded>
			<wfw:commentRss>http://www.thejacklawson.com/index.php/2008/02/n-tiered-ajax/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
