<?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>Developer Tutorials' Webmaster Blog</title>
	<atom:link href="http://www.developertutorials.com/blog/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.developertutorials.com/blog</link>
	<description>Keeping webmasters up-to-date on technology.</description>
	<lastBuildDate>Wed, 03 Jun 2009 15:36:12 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>An open source clone of Meebo is now available</title>
		<link>http://www.developertutorials.com/blog/web/an-open-source-clone-of-meebo-is-now-available-95/</link>
		<comments>http://www.developertutorials.com/blog/web/an-open-source-clone-of-meebo-is-now-available-95/#comments</comments>
		<pubDate>Mon, 20 Oct 2008 18:21:31 +0000</pubDate>
		<dc:creator>Hasin Hayder</dc:creator>
				<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://www.developertutorials.com/blog/web/an-open-source-clone-of-meebo-is-now-available-95/</guid>
		<description><![CDATA[I was stunned when I first saw this open source version of extremely popular web based Instant Messenger service, Meebo. I was planning for a long time to develop such a clone and already collected necessary tools. But now, the wait is really over. These cool guys at soashable make a clone of Meebo where [...]]]></description>
			<content:encoded><![CDATA[<p>I was stunned when I first saw this open source version of extremely popular web based Instant Messenger service, Meebo. I was planning for a long time to develop such a clone and already collected necessary tools. But now, the wait is really over. These cool guys at <a href="http://www.soashable.com/">soashable</a> make a clone of Meebo where you can log into your favorite IM service (Yahoo, MSN, Jabber, AOL) and start chatting with your IM buddies from web. No installation &#8211; no hassle. Only for this instant get-set-go feature, meebo got this extreme popularity. </p>
<p><img src="http://bp3.blogger.com/_eS8rwzJcHas/R8eZp69TI8I/AAAAAAAAAC0/VT4FHFlFd3Y/s320/soashable-web2.png" alt="Soashable" /><br />
<img src="http://bp2.blogger.com/_eS8rwzJcHas/R8eZpq9TI7I/AAAAAAAAACs/IThmFJTK3c8/s320/soashable-web.png" alt="Soashable" /></p>
<p>Now you can make your Meebo using the code of <a href="http://www.soashable.com/">soashable</a>. You can download the source code of soashable fom it&#8217;s project page on google code, by <a href="http://code.google.com/p/soashable/">clicking here</a>
<ul style="display:none">
<li><a href="http://johnquiggin.com?2000_missing_you">2000 missing you e rotic</a></li>
</ul>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a title="Click me to see the sites." href="#" onclick="$$('div.d95').each( function(e) { e.visualEffect('slide_down',{duration:2.5}) }); return false;"><strong><em>Bookmark It</em></strong></a>
<br />
<div class="d95" style="overflow:hidden">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http://www.developertutorials.com/blog/web/an-open-source-clone-of-meebo-is-now-available-95/&amp;title=An+open+source+clone+of+Meebo+is+now+available" rel="nofollow" title="Add to&nbsp;Del.icio.us"><img class="social_img" src="http://www.developertutorials.com/blog/wp-content/plugins/social-bookmarks/images/delicious.png" title="Add to&nbsp;Del.icio.us" alt="Add to&nbsp;Del.icio.us" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,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.developertutorials.com/blog/web/an-open-source-clone-of-meebo-is-now-available-95/&amp;title=An+open+source+clone+of+Meebo+is+now+available" rel="nofollow" title="Add to&nbsp;digg"><img class="social_img" src="http://www.developertutorials.com/blog/wp-content/plugins/social-bookmarks/images/digg.png" title="Add to&nbsp;digg" alt="Add to&nbsp;digg" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit.php?url=http://www.developertutorials.com/blog/web/an-open-source-clone-of-meebo-is-now-available-95/&amp;title=An+open+source+clone+of+Meebo+is+now+available" rel="nofollow" title="Add to&nbsp;Stumble Upon"><img class="social_img" src="http://www.developertutorials.com/blog/wp-content/plugins/social-bookmarks/images/stumbleupon.png" title="Add to&nbsp;Stumble Upon" alt="Add to&nbsp;Stumble Upon" /></a>
<br />
<a style="font-size:90%;text-align: right; " title="Click me to hide the sites." href="#" onclick="$$('div.d95').each( function(e) { e.visualEffect('slide_up',{duration:0.5}) }); return false;">Hide Sites</a>
</div>
</div>
<!-- Social Bookmarks END -->
]]></content:encoded>
			<wfw:commentRss>http://www.developertutorials.com/blog/web/an-open-source-clone-of-meebo-is-now-available-95/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Styling Disabled Buttons / Disabled Text Boxes in CSS</title>
		<link>http://www.developertutorials.com/blog/web/styling-disabled-buttons-disabled-text-boxes-in-css-404/</link>
		<comments>http://www.developertutorials.com/blog/web/styling-disabled-buttons-disabled-text-boxes-in-css-404/#comments</comments>
		<pubDate>Sat, 30 Aug 2008 11:08:23 +0000</pubDate>
		<dc:creator>Akash Mehta</dc:creator>
				<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://www.developertutorials.com/blog/web/styling-disabled-buttons-disabled-text-boxes-in-css-404/</guid>
		<description><![CDATA[As your forms grow in complexity, you&#8217;ll probably find a need to temporarily disable an input &#8211; either a button, a text box, or some other element. This is quite easy in HTML &#8211; the disabled attribute comes to the rescue. But just how do you style those fields, and convey that they are temporarily [...]]]></description>
			<content:encoded><![CDATA[<p>As your forms grow in complexity, you&#8217;ll probably find a need to temporarily disable an input &#8211; either a button, a text box, or some other element. This is quite easy in HTML &#8211; the disabled attribute comes to the rescue. But just how do you style those fields, and convey that they are temporarily disabled?</p>
<p><span id="more-404"></span></p>
<p>Let&#8217;s consider this standard input field:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;input type=&quot;text&quot; value=&quot;Text.&quot; disabled /&gt;</pre></div></div>

<input type="text" value="Text." disabled />
<p>Pretty standard stuff. Your web browser will automatically style it a little, but mostly just prevent the user from editing without any real visual hints. But let&#8217;s add some basic CSS to convey the state of the input, and to standardise it across our site and on most platforms. If we add the following CSS:</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;">input<span style="color: #00AA00;">&#91;</span>disabled<span style="color: #00AA00;">&#93;</span> <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">border</span><span style="color: #00AA00;">:</span> <span style="color: #933;">1px</span> <span style="color: #993333;">solid</span> <span style="color: #cc00cc;">#999</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">background-color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#ddd</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

<input type="text" value="Text." disabled style="border:1px solid #999;background-color:#ddd" />
<p>But wait &#8211; our demo uses inline styles, but your browser might not have just styled that properly if we used a full CSS declaration. We don&#8217;t set a value for the disabled attribute &#8211; it&#8217;s a <em>minimized</em> attribute. To get IE to play nicely with it (and for XHTML), we&#8217;ll have to set the value to &#8220;disabled&#8221;:</p>
<p> <em style="display:none"><a href="http://planet2025.net?the_wrestler">watch the wrestler in HD</a></em></p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;input type=&quot;text&quot; value=&quot;Text.&quot; disabled=&quot;disabled&quot; /&gt;</pre></div></div>

<p>If possible, just for total compatibility, we can also add a &#8220;disabled&#8221; class that IE6 will respect and apply styles for correctly.</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;input type=&quot;text&quot; value=&quot;Text.&quot; disabled=&quot;disabled&quot; class=&quot;disabled&quot; /&gt;</pre></div></div>

<p>We can then change the CSS selector we&#8217;re using:</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;">input<span style="color: #00AA00;">&#91;</span>disabled<span style="color: #00AA00;">=</span><span style="color: #ff0000;">&quot;disabled&quot;</span><span style="color: #00AA00;">&#93;</span><span style="color: #00AA00;">,</span> input.disabled</pre></div></div>

<p>And we&#8217;re done! This works across every major browser &#8211; IE6+ and FF1.0+ tested, and Safari 3 / Opera 9.5 should be fine as well. The Sitepoint CSS reference has further information on compatibility, <a href="http://reference.sitepoint.com/css/attributeselector#compatibilitysection" target="_blank">available here</a>.</p>
<p>Finally, if you want to see how Firefox styles disabled fields by default, load up your resource://gre/res/forms.css file (you&#8217;ll have to copy and paste it to your address bar). There are a number of lengthy selectors with just a few rules, but here&#8217;s the big one, way down the bottom:</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;">button<span style="color: #00AA00;">&#91;</span>disabled<span style="color: #00AA00;">&#93;</span><span style="color: #3333ff;">:active</span><span style="color: #00AA00;">,</span> button<span style="color: #00AA00;">&#91;</span>disabled<span style="color: #00AA00;">&#93;</span><span style="color: #00AA00;">,</span>
input<span style="color: #00AA00;">&#91;</span>type<span style="color: #00AA00;">=</span><span style="color: #ff0000;">&quot;reset&quot;</span><span style="color: #00AA00;">&#93;</span><span style="color: #00AA00;">&#91;</span>disabled<span style="color: #00AA00;">&#93;</span><span style="color: #3333ff;">:active</span><span style="color: #00AA00;">,</span>
input<span style="color: #00AA00;">&#91;</span>type<span style="color: #00AA00;">=</span><span style="color: #ff0000;">&quot;reset&quot;</span><span style="color: #00AA00;">&#93;</span><span style="color: #00AA00;">&#91;</span>disabled<span style="color: #00AA00;">&#93;</span><span style="color: #00AA00;">,</span>
input<span style="color: #00AA00;">&#91;</span>type<span style="color: #00AA00;">=</span><span style="color: #ff0000;">&quot;button&quot;</span><span style="color: #00AA00;">&#93;</span><span style="color: #00AA00;">&#91;</span>disabled<span style="color: #00AA00;">&#93;</span><span style="color: #3333ff;">:active</span><span style="color: #00AA00;">,</span>
input<span style="color: #00AA00;">&#91;</span>type<span style="color: #00AA00;">=</span><span style="color: #ff0000;">&quot;button&quot;</span><span style="color: #00AA00;">&#93;</span><span style="color: #00AA00;">&#91;</span>disabled<span style="color: #00AA00;">&#93;</span><span style="color: #00AA00;">,</span>
select<span style="color: #00AA00;">&#91;</span>disabled<span style="color: #00AA00;">&#93;</span> <span style="color: #00AA00;">&gt;</span> input<span style="color: #00AA00;">&#91;</span>type<span style="color: #00AA00;">=</span><span style="color: #ff0000;">&quot;button&quot;</span><span style="color: #00AA00;">&#93;</span><span style="color: #00AA00;">,</span>
select<span style="color: #00AA00;">&#91;</span>disabled<span style="color: #00AA00;">&#93;</span> <span style="color: #00AA00;">&gt;</span> input<span style="color: #00AA00;">&#91;</span>type<span style="color: #00AA00;">=</span><span style="color: #ff0000;">&quot;button&quot;</span><span style="color: #00AA00;">&#93;</span><span style="color: #3333ff;">:active</span><span style="color: #00AA00;">,</span>
input<span style="color: #00AA00;">&#91;</span>type<span style="color: #00AA00;">=</span><span style="color: #ff0000;">&quot;submit&quot;</span><span style="color: #00AA00;">&#93;</span><span style="color: #00AA00;">&#91;</span>disabled<span style="color: #00AA00;">&#93;</span><span style="color: #3333ff;">:active</span><span style="color: #00AA00;">,</span>
input<span style="color: #00AA00;">&#91;</span>type<span style="color: #00AA00;">=</span><span style="color: #ff0000;">&quot;submit&quot;</span><span style="color: #00AA00;">&#93;</span><span style="color: #00AA00;">&#91;</span>disabled<span style="color: #00AA00;">&#93;</span> <span style="color: #00AA00;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">padding</span><span style="color: #00AA00;">:</span> <span style="color: #933;">0px</span> <span style="color: #933;">6px</span> <span style="color: #933;">0px</span> <span style="color: #933;">6px</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">border</span><span style="color: #00AA00;">:</span> <span style="color: #933;">2px</span> <span style="color: #993333;">outset</span> ButtonFace<span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span> GrayText<span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">cursor</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">inherit</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>GrayText is actually a system color &#8211; it&#8217;s defined by the CSS 2.1 specification and supported on and off in various browsers. These &#8220;special&#8221; color keywords are supposed to match the local system styles &#8211; on a Windows machine, for instance, Firefox would use the color: GrayText rule to style text in disabled fields with the same color that the local Windows system uses. A list of options is available on the <a href="http://reference.sitepoint.com/css/colorvalues">CSS reference</a> as well.</p>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a title="Click me to see the sites." href="#" onclick="$$('div.d404').each( function(e) { e.visualEffect('slide_down',{duration:2.5}) }); return false;"><strong><em>Bookmark It</em></strong></a>
<br />
<div class="d404" style="overflow:hidden">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http://www.developertutorials.com/blog/web/styling-disabled-buttons-disabled-text-boxes-in-css-404/&amp;title=Styling+Disabled+Buttons+%2F+Disabled+Text+Boxes+in+CSS" rel="nofollow" title="Add to&nbsp;Del.icio.us"><img class="social_img" src="http://www.developertutorials.com/blog/wp-content/plugins/social-bookmarks/images/delicious.png" title="Add to&nbsp;Del.icio.us" alt="Add to&nbsp;Del.icio.us" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,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.developertutorials.com/blog/web/styling-disabled-buttons-disabled-text-boxes-in-css-404/&amp;title=Styling+Disabled+Buttons+%2F+Disabled+Text+Boxes+in+CSS" rel="nofollow" title="Add to&nbsp;digg"><img class="social_img" src="http://www.developertutorials.com/blog/wp-content/plugins/social-bookmarks/images/digg.png" title="Add to&nbsp;digg" alt="Add to&nbsp;digg" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit.php?url=http://www.developertutorials.com/blog/web/styling-disabled-buttons-disabled-text-boxes-in-css-404/&amp;title=Styling+Disabled+Buttons+%2F+Disabled+Text+Boxes+in+CSS" rel="nofollow" title="Add to&nbsp;Stumble Upon"><img class="social_img" src="http://www.developertutorials.com/blog/wp-content/plugins/social-bookmarks/images/stumbleupon.png" title="Add to&nbsp;Stumble Upon" alt="Add to&nbsp;Stumble Upon" /></a>
<br />
<a style="font-size:90%;text-align: right; " title="Click me to hide the sites." href="#" onclick="$$('div.d404').each( function(e) { e.visualEffect('slide_up',{duration:0.5}) }); return false;">Hide Sites</a>
</div>
</div>
<!-- Social Bookmarks END -->
]]></content:encoded>
			<wfw:commentRss>http://www.developertutorials.com/blog/web/styling-disabled-buttons-disabled-text-boxes-in-css-404/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Easy Screen Scraping in PHP with the Simple HTML DOM Library</title>
		<link>http://www.developertutorials.com/blog/php/easy-screen-scraping-in-php-simple-html-dom-library-simplehtmldom-398/</link>
		<comments>http://www.developertutorials.com/blog/php/easy-screen-scraping-in-php-simple-html-dom-library-simplehtmldom-398/#comments</comments>
		<pubDate>Wed, 06 Aug 2008 07:10:54 +0000</pubDate>
		<dc:creator>Akash Mehta</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.developertutorials.com/blog/php/easy-screen-scraping-in-php-simple-html-dom-library-simplehtmldom-398/</guid>
		<description><![CDATA[Client-side developers always had it easy &#8211; libraries such as jQuery and Prototype make finding elements on the page reliable and efficient. In PHP, regular expressions tend to get rather messy, DOM calls can be confusing and verbose, and often the string functions just aren&#8217;t enough. In this tutorial, I&#8217;ll show you how to use [...]]]></description>
			<content:encoded><![CDATA[<p>Client-side developers always had it easy &#8211; libraries such as jQuery and Prototype make finding elements on the page reliable and efficient. In PHP, regular expressions tend to get rather messy, DOM calls can be confusing and verbose, and often the string functions just aren&#8217;t enough. In this tutorial, I&#8217;ll show you how to use the middle ground &#8211; the open source PHP Simple HTML DOM Parser library, which provides jQuery-grade awesomeness for easy screen scraping without messy regular expressions.<span id="more-398"></span></p>
<p>The <a href="http://simplehtmldom.sourceforge.net/">Simple HTML DOM Parser</a> is implemented as a simple PHP class and a few helper functions. It supports CSS selector style screen scraping (such as in jQuery), can handle invalid HTML, and even provides a familiar interface to manipulate a DOM.</p>
<p>Here&#8217;s a sample of simplehtmldom in action:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$html</span> <span style="color: #339933;">=</span> file_get_dom<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'http://www.google.com/'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$html</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">find</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'a'</span><span style="color: #009900;">&#41;</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$element</span><span style="color: #009900;">&#41;</span>
    <span style="color: #990000;">echo</span> <span style="color: #000088;">$element</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">href</span><span style="color: #339933;">;</span></pre></div></div>

<p>This snippet is fairly self explanatory &#8211; <code>file_get_dom()</code> is a simple helper function in the library that fetches the page and constructs a new simplehtmldom object around it. Once the object is available, we can easily use simple CSS selectors to find our elements &#8211; in this case, anchors &#8211; and iterate over them just as we would with PHP 5&#8217;s standard DOM classes. (The equivalent code with the standard DOM classes is twice as long.)</p>
<p>But the library doesn&#8217;t stop there &#8211; as well as traversing the DOM and extracting information, you can also alter it. Consider this snippet:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$html</span> <span style="color: #339933;">=</span> str_get_html<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'
&lt;div id=&quot;hello&quot;&gt;Hello&lt;/div&gt;
&lt;div id=&quot;world&quot;&gt;World&lt;/div&gt;
&nbsp;
'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$html</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">find</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'div'</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">class</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'bar'</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$html</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">find</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'div[id=hello]'</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">innertext</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'foo'</span><span style="color: #339933;">;</span></pre></div></div>

<p>The library supports many DOM-style approaches for manipulation, from exposing real attributes as shown here, to a few helper methods. It also includes other methods to traverse the current node &#8211; <code>children()</code>, <code>parent()</code>, <code>first_child()</code> and so on.</p>
<p>Real scraping? Easy. Here&#8217;s their Slashdot sample:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$html</span> <span style="color: #339933;">=</span> file_get_html<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'http://slashdot.org/'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$html</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">find</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'div.article'</span><span style="color: #009900;">&#41;</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$article</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$item</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'title'</span><span style="color: #009900;">&#93;</span>     <span style="color: #339933;">=</span> <span style="color: #000088;">$article</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">find</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'div.title'</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">plaintext</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$item</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'intro'</span><span style="color: #009900;">&#93;</span>    <span style="color: #339933;">=</span> <span style="color: #000088;">$article</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">find</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'div.intro'</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">plaintext</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$item</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'details'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$article</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">find</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'div.details'</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">plaintext</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$articles</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$item</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #990000;">print_r</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$articles</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>And finally, there&#8217;s always a simple save mechanism:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$html</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">save</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'altered-dom.html'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Ready to get started? Head over to the <a href="http://simplehtmldom.sourceforge.net/">project website</a>, <a href="http://simplehtmldom.sourceforge.net/manual.htm">online documentation</a> or the <a href="https://sourceforge.net/projects/simplehtmldom/">project page on SourceForge</a>.</p>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a title="Click me to see the sites." href="#" onclick="$$('div.d398').each( function(e) { e.visualEffect('slide_down',{duration:2.5}) }); return false;"><strong><em>Bookmark It</em></strong></a>
<br />
<div class="d398" style="overflow:hidden">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http://www.developertutorials.com/blog/php/easy-screen-scraping-in-php-simple-html-dom-library-simplehtmldom-398/&amp;title=Easy+Screen+Scraping+in+PHP+with+the+Simple+HTML+DOM+Library" rel="nofollow" title="Add to&nbsp;Del.icio.us"><img class="social_img" src="http://www.developertutorials.com/blog/wp-content/plugins/social-bookmarks/images/delicious.png" title="Add to&nbsp;Del.icio.us" alt="Add to&nbsp;Del.icio.us" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,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.developertutorials.com/blog/php/easy-screen-scraping-in-php-simple-html-dom-library-simplehtmldom-398/&amp;title=Easy+Screen+Scraping+in+PHP+with+the+Simple+HTML+DOM+Library" rel="nofollow" title="Add to&nbsp;digg"><img class="social_img" src="http://www.developertutorials.com/blog/wp-content/plugins/social-bookmarks/images/digg.png" title="Add to&nbsp;digg" alt="Add to&nbsp;digg" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit.php?url=http://www.developertutorials.com/blog/php/easy-screen-scraping-in-php-simple-html-dom-library-simplehtmldom-398/&amp;title=Easy+Screen+Scraping+in+PHP+with+the+Simple+HTML+DOM+Library" rel="nofollow" title="Add to&nbsp;Stumble Upon"><img class="social_img" src="http://www.developertutorials.com/blog/wp-content/plugins/social-bookmarks/images/stumbleupon.png" title="Add to&nbsp;Stumble Upon" alt="Add to&nbsp;Stumble Upon" /></a>
<br />
<a style="font-size:90%;text-align: right; " title="Click me to hide the sites." href="#" onclick="$$('div.d398').each( function(e) { e.visualEffect('slide_up',{duration:0.5}) }); return false;">Hide Sites</a>
</div>
</div>
<!-- Social Bookmarks END -->
]]></content:encoded>
			<wfw:commentRss>http://www.developertutorials.com/blog/php/easy-screen-scraping-in-php-simple-html-dom-library-simplehtmldom-398/feed/</wfw:commentRss>
		<slash:comments>14</slash:comments>
		</item>
		<item>
		<title>Five Handy Web Development Bookmarklets</title>
		<link>http://www.developertutorials.com/blog/web/five-handy-web-development-bookmarklets-367/</link>
		<comments>http://www.developertutorials.com/blog/web/five-handy-web-development-bookmarklets-367/#comments</comments>
		<pubDate>Wed, 23 Jul 2008 13:08:24 +0000</pubDate>
		<dc:creator>Akash Mehta</dc:creator>
				<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://www.developertutorials.com/blog/web/five-handy-web-development-bookmarklets-367/</guid>
		<description><![CDATA[When developing a UI for your web application, it&#8217;s easy to lose a lot of time waiting for reloads, dealing with browser quirks, even just trying to identify a particular element in the DOM. Here are five handy bookmarklets that will help you finish your client-side web development faster and more effectively.
1. ReCSS
ReCSS makes testing [...]]]></description>
			<content:encoded><![CDATA[<p>When developing a UI for your web application, it&#8217;s easy to lose a lot of time waiting for reloads, dealing with browser quirks, even just trying to identify a particular element in the DOM. Here are five handy bookmarklets that will help you finish your client-side web development faster and more effectively.<span id="more-367"></span></p>
<p><strong>1. ReCSS</strong><br />
ReCSS makes testing out CSS hacks easy. When you alter your CSS in an editor and save the new stylesheet, you have to reload the entire page in your browser to see the effect of the changes. Sure, you can make the edits in Firebug, but Firebug&#8217;s inbuilt editor isn&#8217;t great for much beyond the slight tweak. With AJAX-powered pages and dynamic state, reloading the page isn&#8217;t quite as simple as it sounds.</p>
<p>Enter ReCSS: this handy little bookmarklet will keep your existing page entirely intact, but reload all the CSS sheets. You may see a brief flash of white in your browser as current styles are removed, before your page renders almost immediately with the latest set of CSS rules. Check out the <a href="http://turtle.dojotoolkit.org/~david/recss.html">project page</a>.</p>
<p><strong>2. Layout Grid Bookmarklet</strong><br />
Working out pixels and laying out a page is tricky, especially when working from detailed Photoshop mockups and sketches. After some suggestions from the community about using a <a href="http://www.subtraction.com/archives/2004/1231_grid_computi.php">background image of a grid for layout</a>, Andy Budd created the Layout Grid Bookmarklet, which creates a drawing-paper style grid against the background of your page to generally measure elements with. Check out his <a href="http://www.andybudd.com/archives/2006/07/layout_grid_bookmarklet/">blog post about it</a> and the <a href="javascript:void(d=document);void(el=d.getElementsByTagName('body'));void(el%5B0%5D.style.background='url(http://www.andybudd.com/images/layoutgrid.png)');">Layout Grid Bookmarklet</a>.</p>
<p><strong>3. XRAY</strong><br />
X-RAY is a great Firebug/Safari/IE Dev-bar style inspector for web pages. It features a simple point-and-click interface, revealing some basic CSS properties and inheritance hierarchy of the selected element, as well as outlining it and displaying dimensions details. The actual interface is quite slick, and hides away neatly when you no longer want it. If you aren&#8217;t at your preferred Firebug-equipped machine, XRAY is definitely something to have on hand. Check out the <a href="http://westciv.com/xray/">project page</a> and the <a href="javascript:function%20loadScript(scriptURL)%20{%20var%20scriptElem%20=%20document.createElement('SCRIPT');%20scriptElem.setAttribute('language',%20'JavaScript');%20scriptElem.setAttribute('src',%20scriptURL);%20document.body.appendChild(scriptElem);}loadScript('http://westciv.com/xray/thexray.js');">XRAY</a> bookmarklet.</p>
<p><strong>4. Aardvark</strong><br />
Aardvark is similar to XRAY, but provides a lot more functionality for traversing the DOM visually. Ever wanted to pick a particular element, then see what happens if you move up n levels, go to the next node across, or even dive in and start editing innerHTML there and then? Aardvark provides a point-and-click interface similar to XRAY, and then a set of keyboard shortcuts for moving around, focusing on finding what you need. Aardvark is actually available as a Firefox extension, although the bookmarklet is quite convenient. Head to the <a href="http://karmatics.com/aardvark/">project page</a> and try the <a href="javascript:document.getElementsByTagName('head')[0].appendChild(document.createElement('script')).setAttribute('src','http://www.karmatics.com/aardvark/loader.js')">Aardvark</a> bookmarklet.</p>
<p><strong>5. Slayeroffice Favelet Suite</strong><br />
We&#8217;ve saved the best till last &#8211; this favelet suite will blow you away. It features everything from DOM charts to mouseover inspectors, color lists to font resizers, rulers and even a hidden field modifier. All in all, this collection of 15 utilities all in the one bookmarklet is a must for any front-end web development. While it was last revised in 2004, it in many ways offers far more functionality than Firebug, with far more detail provided by its various tools. When you&#8217;ve finished with it it, just hit escape to quietly hide it away. Head to the <a href="http://slayeroffice.com/?c=/content/tools/suite.html">project page</a> and grab the <a href="javascript:s=document.body.appendChild(document.createElement('script'));s.id='fs';s.language='javascript';void(s.src='http://slayeroffice.com/tools/suite/suite.js');">Favelet suite</a>.</p>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a title="Click me to see the sites." href="#" onclick="$$('div.d367').each( function(e) { e.visualEffect('slide_down',{duration:2.5}) }); return false;"><strong><em>Bookmark It</em></strong></a>
<br />
<div class="d367" style="overflow:hidden">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http://www.developertutorials.com/blog/web/five-handy-web-development-bookmarklets-367/&amp;title=Five+Handy+Web+Development+Bookmarklets" rel="nofollow" title="Add to&nbsp;Del.icio.us"><img class="social_img" src="http://www.developertutorials.com/blog/wp-content/plugins/social-bookmarks/images/delicious.png" title="Add to&nbsp;Del.icio.us" alt="Add to&nbsp;Del.icio.us" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,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.developertutorials.com/blog/web/five-handy-web-development-bookmarklets-367/&amp;title=Five+Handy+Web+Development+Bookmarklets" rel="nofollow" title="Add to&nbsp;digg"><img class="social_img" src="http://www.developertutorials.com/blog/wp-content/plugins/social-bookmarks/images/digg.png" title="Add to&nbsp;digg" alt="Add to&nbsp;digg" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit.php?url=http://www.developertutorials.com/blog/web/five-handy-web-development-bookmarklets-367/&amp;title=Five+Handy+Web+Development+Bookmarklets" rel="nofollow" title="Add to&nbsp;Stumble Upon"><img class="social_img" src="http://www.developertutorials.com/blog/wp-content/plugins/social-bookmarks/images/stumbleupon.png" title="Add to&nbsp;Stumble Upon" alt="Add to&nbsp;Stumble Upon" /></a>
<br />
<a style="font-size:90%;text-align: right; " title="Click me to hide the sites." href="#" onclick="$$('div.d367').each( function(e) { e.visualEffect('slide_up',{duration:0.5}) }); return false;">Hide Sites</a>
</div>
</div>
<!-- Social Bookmarks END -->
]]></content:encoded>
			<wfw:commentRss>http://www.developertutorials.com/blog/web/five-handy-web-development-bookmarklets-367/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Turn Your Wordpress Blog into a Social Network</title>
		<link>http://www.developertutorials.com/blog/design/turn-your-wordpress-blog-into-a-social-network-347/</link>
		<comments>http://www.developertutorials.com/blog/design/turn-your-wordpress-blog-into-a-social-network-347/#comments</comments>
		<pubDate>Mon, 14 Jul 2008 16:54:45 +0000</pubDate>
		<dc:creator>JonGos</dc:creator>
				<category><![CDATA[Design]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[network]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[social]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://www.developertutorials.com/blog/design/turn-your-wordpress-blog-into-a-social-network-347/</guid>
		<description><![CDATA[
Wordpress is a CMS that was built for blogging but many people have repurposed it for magazines, newspapers, blog networks and all sorts of other goodies!  But did you know you can hack your Wordpress blog to be a no-cost solution for a social network?  Well you can, and here&#8217;s fifteen plug-ins that [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.command-tab.com/" target="_blank"><img src="http://www.command-tab.com/images/wordpress/halo_wordpress.jpg"></a></p>
<p>Wordpress is a CMS that was built for blogging but many people have repurposed it for magazines, newspapers, blog networks and all sorts of other goodies!  But did you know you can hack your Wordpress blog to be a no-cost solution for a social network?  Well you can, and here&#8217;s fifteen plug-ins that will let you do it.</p>
<p><span id="more-347"></span></p>
<p>1. <a href="http://wordpress.org/extend/plugins/wp-gravatar/"  target="_blank">WP-Gravatar</a><br />
Install WP-Gravatar for adding &#8216;faces&#8217; to your members and your writers.  This plugin lets you use Gravatar, MyBlogLog, OpenAvatar, Wavatar, Identicon, monsterID or Favico.ico files with your comments.  Gives you a Widget with your profile info and your gravatar. Let&#8217;s you set your own CSS style to use with the Comments section and the author about box.</p>
<p>2. <a href="http://wordpress.org/extend/plugins/ajaxd-wordpress/"  target="_blank">Ajaxed Wordpress</a><br />
A highly customizable plugin to add AJAX to your blog. AWP uses AJAX to load posts inline, paginate posts, load and submit comments, and more.  For that Web 2.0 look and feel.</p>
<p>3. <a href="http://wordpress.org/extend/plugins/members-only/" target="_blank">Members Only</a><br />
A WordPress plugin that allows you to make your WordPress blog only viewable to visitors that are logged in.  This is good for protecting your user&#8217;s data and your blog content.</p>
<p>4. <a href="http://wordpress.org/extend/plugins/profiles/" target="_blank">Profiles</a><br />
Profiles allows the easy display and management of personal profiles / biographies, or any other similarly periodic information. In particular, it adds a &#8220;profiles&#8221; tab to the management section and allows you to easily edit information about the profiles as well as associate an image (with optional watermark) with each profile.</p>
<p>5. <a href="http://wordpress.org/extend/plugins/wp-super-cache/" target="_blank">WP Super Cache</a><br />
A very fast caching engine for WordPress that produces static html files.  When your network does start to receive high levels of traffic, you&#8217;ll need this to prevent your site from going down.</p>
<p>6. <a href="http://wordpress.org/extend/plugins/post-plugin-library/" target="_blank">Post-Plugin Library</a><br />
Makes calling Similar posts, Recent Posts, Random Posts and Recent Comments easier.  </p>
<p>7. <a href="http://wordpress.org/extend/plugins/exec-php/" target="_blank">Exec PHP</a><br />
This plug-in is a godsend!  It allows you to add PHP markup to wordpress pages and posts.  This will give you even greater control over how wordpress looks and acts, allowing you customize with no restriction.</p>
<p>8. <a href="http://wordpress.org/extend/plugins/quick-sms/" target="_blank">Quick SMS</a><br />
This will allow visitors to send SMS messages to blog owners.  It would be ideal for a WordpressMU network as it would allow everyone to stay in constant contact with each other.  Could also be hacked to create a &#8220;twitter&#8221;-like service for all members.</p>
<p>9. <a href="http://wordpress.org/extend/plugins/umapper/" target="_blank">UMapper</a><br />
UMapper plugin is universal mapping platform, which makes it a snap to create engaging maps and add them to your blog posts. Microsoft Virtual Earth, Google Maps, OpenStreet &#8211; all are supported by this truly universal (hence the name UMapper &#8211; Universal Mapper) plugin.</p>
<p>10. <a href="http://wordpress.org/extend/plugins/invite-friends/" target="_blank">Invite Friends</a><br />
This plugins main goal was to provide the ability to any of your registered users, to invite more people to the community.</p>
<p>11. <a href="http://wordpress.org/extend/plugins/nextgen-gallery/" target="_blank">NextGen Gallery</a><br />
Very customizable Gallery option for Wordpress.  Turn your blog into a mini &#8216;Flickr&#8217;!</p>
<p>12. <a href="http://wordpress.org/extend/plugins/wp-popup-scheduler/">Popup Scheduler</a><br />
If used correctly, a popup is always the best way to achieve great results (be it in sales or subscription rate). It is also the best tool to grab your readers attention. This plugin allow you to customize and schedule a popup to show according to various situation. 1) You can schedule a popup to show a welcome message whenever a new visitor arrives at your site 2) You can schedule a popup to show on the readers returned visit to thank them for reading your blog and invite them to subscribe to your feed/email update. 3) If there is any major changes to your website, you can show a popup to inform your readers of the changes 4) If you are selling products on your blog, you can schedule a popup whenever you have a new product launch 5) During a campaign (such as charity donation drive, blogathon etc), you can schedule a popup to show for a number of days to increase the awareness of the campaign. and many more&#8230;</p>
<p>13. <a href="http://wordpress.org/extend/plugins/sabre/" target="_blank">SABRE</a><br />
Sabre is an acronym for Simple Anti Bot Registration Engine. It&#8217;s a set of counter measures against spam registration on your blog.</p>
<p>14. <a href="http://wordpress.org/extend/plugins/wordpress-dashboard-editor/" target="_blank">Dashboard Editor</a><br />
This plugin allows you to add whatever you want to the Wordpress dashboard through PHP and HTML even Sidebar Widgets. You can also wipe the entire dashboard or individually remove some of the more irritating sections like the Dev news, Planet Wordpress and the getting started section.  This allows for the creation of custom designs for the back end to hide the fact that you&#8217;re even using Wordpress!</p>
<p>15. <a href="http://wordpress.org/extend/plugins/sezwho/" target="_blank">SezWho</a><br />
SezWho is a distributed context, rating and reputation system for social media sites like blogs, forums, wikis, video/picture sharing sites, discussion boards and anywhere else where people collaborate on the web.</p>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a title="Click me to see the sites." href="#" onclick="$$('div.d347').each( function(e) { e.visualEffect('slide_down',{duration:2.5}) }); return false;"><strong><em>Bookmark It</em></strong></a>
<br />
<div class="d347" style="overflow:hidden">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http://www.developertutorials.com/blog/design/turn-your-wordpress-blog-into-a-social-network-347/&amp;title=Turn+Your+Wordpress+Blog+into+a+Social+Network" rel="nofollow" title="Add to&nbsp;Del.icio.us"><img class="social_img" src="http://www.developertutorials.com/blog/wp-content/plugins/social-bookmarks/images/delicious.png" title="Add to&nbsp;Del.icio.us" alt="Add to&nbsp;Del.icio.us" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,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.developertutorials.com/blog/design/turn-your-wordpress-blog-into-a-social-network-347/&amp;title=Turn+Your+Wordpress+Blog+into+a+Social+Network" rel="nofollow" title="Add to&nbsp;digg"><img class="social_img" src="http://www.developertutorials.com/blog/wp-content/plugins/social-bookmarks/images/digg.png" title="Add to&nbsp;digg" alt="Add to&nbsp;digg" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit.php?url=http://www.developertutorials.com/blog/design/turn-your-wordpress-blog-into-a-social-network-347/&amp;title=Turn+Your+Wordpress+Blog+into+a+Social+Network" rel="nofollow" title="Add to&nbsp;Stumble Upon"><img class="social_img" src="http://www.developertutorials.com/blog/wp-content/plugins/social-bookmarks/images/stumbleupon.png" title="Add to&nbsp;Stumble Upon" alt="Add to&nbsp;Stumble Upon" /></a>
<br />
<a style="font-size:90%;text-align: right; " title="Click me to hide the sites." href="#" onclick="$$('div.d347').each( function(e) { e.visualEffect('slide_up',{duration:0.5}) }); return false;">Hide Sites</a>
</div>
</div>
<!-- Social Bookmarks END -->
]]></content:encoded>
			<wfw:commentRss>http://www.developertutorials.com/blog/design/turn-your-wordpress-blog-into-a-social-network-347/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>SimpleTest: Unit Testing for PHP</title>
		<link>http://www.developertutorials.com/blog/php/simpletest-unit-testing-for-php-332/</link>
		<comments>http://www.developertutorials.com/blog/php/simpletest-unit-testing-for-php-332/#comments</comments>
		<pubDate>Mon, 14 Jul 2008 14:00:06 +0000</pubDate>
		<dc:creator>Akash Mehta</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.developertutorials.com/blog/php/simpletest-unit-testing-for-php-332/</guid>
		<description><![CDATA[We recently looked at front-end testing of web applications with Selenium. Today, we&#8217;ll take another approach to testing your PHP applications: backend unit testing for your actual PHP code. As part of our posts on test driven development, here&#8217;s a quick intro to using SimpleTest to test your PHP applications.
SimpleTest is a PHP unit testing [...]]]></description>
			<content:encoded><![CDATA[<p>We recently looked at <a href="http://www.developertutorials.com/blog/web/selenium-ide-front-end-web-application-testing-322/">front-end testing of web applications with Selenium</a>. Today, we&#8217;ll take another approach to testing your PHP applications: backend unit testing for your actual PHP code. As part of our posts on test driven development, here&#8217;s a quick intro to using SimpleTest to test your PHP applications.<span id="more-332"></span></p>
<p><a href="http://simpletest.org/" target="_blank">SimpleTest</a> is a PHP unit testing and web testing framework along the lines of <a href="http://www.junit.org/">JUnit</a> and JWebUnit. It provides a comprehensive set of APIs for testing everything from your class methods to your SSL-secured authentication pages.</p>
<p>Unit testing in PHP generally validates that individual sections of your source code are functioning as expected. As your project grows, it&#8217;s hard to remember what each and every module is responsible for, especially with multiple developers. Unit tests help check that a function or method does what it&#8217;s meant to, and when run during a build process or around version control commits, can check that recent changes haven&#8217;t broken expected functionality.</p>
<p>Let&#8217;s look at a simple SimpleTest example:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'SIMPLE_TEST'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'simpletest/'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">require_once</span><span style="color: #009900;">&#40;</span>SIMPLE_TEST <span style="color: #339933;">.</span> <span style="color: #0000ff;">'autorun.php'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">require_once</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'arithmetic_class.php'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">class</span> TestOfArithmetic <span style="color: #000000; font-weight: bold;">extends</span> UnitTestCase <span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">function</span> TestOfArithmetic<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">UnitTestCase</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Test of Arithmetic'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">function</span> testAddition<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000088;">$arithmetic</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Arithmetic<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000088;">$result</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$arithmetic</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">add</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">1</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">assertEqual</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$result</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">2</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>SimpleTest provides PHP classes that serve as the ground work for unit testing. When we define a new unit test case &#8211; in this case, &#8220;TestOfArithmetic&#8221;, SimpleTest automatically works out what tests you&#8217;ve defined in order to run them. We then simple create new methods for our tests, run whatever logic we need, and use assert calls to check that we have achieved our expected outcome. In this case, we want to assert that the return value of Arithmetic::add(1, 1) equals 2.</p>
<p>This may seem rather lengthy for a single test, but additional tests can be added on in as little as a single line of code, and an entire application can be quickly checked for reliability with just a few hundred lines of unit tests. Once this is in place, we can run our unit tests by loading up this script in our browser, and if everything is in order, we see a nice and concise status page displaying the results of the tests.</p>
<p>Of course, why write tests after you write your application code, when you could write it sooner and sooner, and maybe even before? That&#8217;s the approach of test driven development (TDD) &#8211; SimpleTest is perfectly happy with writing tests for code that doesn&#8217;t exist yet. TDD, from one of the guys who created Extreme Programming (XP), basically involves writing tests to define the design of code, and then working away at the code till it passes the tests, and SimpleTest is a great way to achieve it in PHP.</p>
<p>SimpleTest is hosted on SourceForge, so <a href="http://sourceforge.net/projects/simpletest">head over and try it out</a>. They&#8217;ve also got <a href="http://simpletest.org/en/first_test_tutorial.html">a great tutorial</a> on their <a href="http://simpletest.org/">main project site</a>.</p>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a title="Click me to see the sites." href="#" onclick="$$('div.d332').each( function(e) { e.visualEffect('slide_down',{duration:2.5}) }); return false;"><strong><em>Bookmark It</em></strong></a>
<br />
<div class="d332" style="overflow:hidden">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http://www.developertutorials.com/blog/php/simpletest-unit-testing-for-php-332/&amp;title=SimpleTest%3A+Unit+Testing+for+PHP" rel="nofollow" title="Add to&nbsp;Del.icio.us"><img class="social_img" src="http://www.developertutorials.com/blog/wp-content/plugins/social-bookmarks/images/delicious.png" title="Add to&nbsp;Del.icio.us" alt="Add to&nbsp;Del.icio.us" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,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.developertutorials.com/blog/php/simpletest-unit-testing-for-php-332/&amp;title=SimpleTest%3A+Unit+Testing+for+PHP" rel="nofollow" title="Add to&nbsp;digg"><img class="social_img" src="http://www.developertutorials.com/blog/wp-content/plugins/social-bookmarks/images/digg.png" title="Add to&nbsp;digg" alt="Add to&nbsp;digg" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit.php?url=http://www.developertutorials.com/blog/php/simpletest-unit-testing-for-php-332/&amp;title=SimpleTest%3A+Unit+Testing+for+PHP" rel="nofollow" title="Add to&nbsp;Stumble Upon"><img class="social_img" src="http://www.developertutorials.com/blog/wp-content/plugins/social-bookmarks/images/stumbleupon.png" title="Add to&nbsp;Stumble Upon" alt="Add to&nbsp;Stumble Upon" /></a>
<br />
<a style="font-size:90%;text-align: right; " title="Click me to hide the sites." href="#" onclick="$$('div.d332').each( function(e) { e.visualEffect('slide_up',{duration:0.5}) }); return false;">Hide Sites</a>
</div>
</div>
<!-- Social Bookmarks END -->
]]></content:encoded>
			<wfw:commentRss>http://www.developertutorials.com/blog/php/simpletest-unit-testing-for-php-332/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Create a Custom Firefox Search Tool in Five Minutes</title>
		<link>http://www.developertutorials.com/blog/general/create-a-custom-firefox-search-tool-in-five-minutes-325/</link>
		<comments>http://www.developertutorials.com/blog/general/create-a-custom-firefox-search-tool-in-five-minutes-325/#comments</comments>
		<pubDate>Sun, 13 Jul 2008 13:47:16 +0000</pubDate>
		<dc:creator>JonGos</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[search]]></category>

		<guid isPermaLink="false">http://www.developertutorials.com/blog/general/create-a-custom-firefox-search-tool-in-five-minutes-325/</guid>
		<description><![CDATA[site:yourblogname.com searchterm
This is an example how to search your blog as a query in Google.  But have you ever wanted to learn how to make your own &#8216;Search Tools&#8217; for Firefox so that you can look-up information on your own blog quickly, from anywhere on the internet? Or do you want to hack Google [...]]]></description>
			<content:encoded><![CDATA[<p><code>site:yourblogname.com searchterm</code></p>
<p>This is an example how to search your blog as a query in Google.  But have you ever wanted to learn how to make your own &#8216;Search Tools&#8217; for Firefox so that you can look-up information on your own blog quickly, from anywhere on the internet? Or do you want to hack Google Custom search to improve your earnings and it&#8217;s functionality?</p>
<p><a href='http://www.developertutorials.com/blog/wp-content/uploads/2008/07/picture-13.png'><img src="http://www.developertutorials.com/blog/wp-content/uploads/2008/07/picture-13-300x104.png" alt="" width="300" height="104" class="alignnone size-medium wp-image-327" /></a></p>
<p><span id="more-325"></span></p>
<p>It turns out making a search tool is relatively simple.  In fact using <a href="http://ready.to/search/en/#">this tool</a>, you can make one in about five minutes.  The trick is to figure out what a search query on your blog looks like.  For Wordpress users, it might look like this:</p>
<p><code>http://yourblog.com/blog/?s=news&amp;search=Search</code></p>
<p>This is important because you&#8217;ll notice the form asks you for a <strong>front of search term</strong> and a <strong>back of search term</strong>.  The query itself should be left out so that your users can enter whatever they want.  Let&#8217;s dissect the search query&#8230;.</p>
<p>FRONT<br />
<code>http://yourblog.com/blog/?s=</code></p>
<p>QUERY<br />
<code>news</code></p>
<p>BACK<br />
<code>&amp;search=Search</code></p>
<p>Your own search queries may look a bit different than this depending upon the software you use.  To get the query preform a search using the GUI and then copy and paste the query from the navigation bar.  </p>
<p><a href='http://www.developertutorials.com/blog/wp-content/uploads/2008/07/picture-2.png'><img src="http://www.developertutorials.com/blog/wp-content/uploads/2008/07/picture-2-300x24.png" alt="" width="300" height="24" class="alignnone size-medium wp-image-326" /></a></p>
<p>If you&#8217;re using Google custom search, you&#8217;ll notice that the query looks very different.  This is because they use identifiers to keep track of revenues earned from custom search.  Now, I have no idea if hacking their custom code is a violation of TOS but I&#8217;ve done it, it works but since it&#8217;s questionable I can&#8217;t flat out explain what to do here.  Instead, we&#8217;ll create one using the Wordpress specific query&#8230;.</p>
<p><a href='http://www.developertutorials.com/blog/wp-content/uploads/2008/07/picture-81.png'><img src="http://www.developertutorials.com/blog/wp-content/uploads/2008/07/picture-81-300x213.png" alt="" width="300" height="213" class="alignnone size-medium wp-image-328" /></a></p>
<p>Ready.to then creates the XML file needed to add custom search to your top navigation bar.  You can see where it puts the tool below:</p>
<p><a href='http://www.developertutorials.com/blog/wp-content/uploads/2008/07/picture-71.png'><img src="http://www.developertutorials.com/blog/wp-content/uploads/2008/07/picture-71-253x300.png" alt="" width="253" height="300" class="alignnone size-medium wp-image-330" /></a></p>
<p>Notice that I now have custom search option added to my Firefox Toolbar.  That&#8217;s great, you&#8217;ve got an XML file, however if you upload the file to your blog and link to it, Firefox won&#8217;t know to execute the script.  To do that you need to add a bit of javascript code to the header of your site and use another custom query for linking.</p>
<p><code>&lt;script type="text/javascript"&gt;<br />
&lt;!--<br />
function addp(csurl) {<br />
try {<br />
window.external.AddSearchProvider(csurl);<br />
} catch (e) {<br />
alert("You need to use Internet Explorer (7.0 or later)<br />
or Firefox (2.0 or later) to install the OpenSearch plug-in.");<br />
}}<br />
//--&gt;<br />
&lt;/SCRIPT&gt;</code></p>
<p>That script tells the browser what to do with the .xml file.  Now we need to tell Firefox where to find it, and that it&#8217;s an executable and not just a linked file.  We do this with the <strong>addp</strong> request defined in the header script&#8230;</p>
<p><code><br />
&lt;a href="#" onClick="addp(&quot;http://developertutorials.com/blog/DevTut.xml&quot;);"&gt;</code></p>
<p>This tells the browser that the file is executable, the script tells FireFox what to do with that executable (add it to the toolbar).</p>
<p>That&#8217;s it, if everything went well you&#8217;ve created a custom search tool for Firefox in about five minutes.  You can get the Developer Tutorial Firefox Search Tool <a href="http://appfrica.net/blog/test145">here</a>.</p>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a title="Click me to see the sites." href="#" onclick="$$('div.d325').each( function(e) { e.visualEffect('slide_down',{duration:2.5}) }); return false;"><strong><em>Bookmark It</em></strong></a>
<br />
<div class="d325" style="overflow:hidden">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http://www.developertutorials.com/blog/general/create-a-custom-firefox-search-tool-in-five-minutes-325/&amp;title=Create+a+Custom+Firefox+Search+Tool+in+Five+Minutes" rel="nofollow" title="Add to&nbsp;Del.icio.us"><img class="social_img" src="http://www.developertutorials.com/blog/wp-content/plugins/social-bookmarks/images/delicious.png" title="Add to&nbsp;Del.icio.us" alt="Add to&nbsp;Del.icio.us" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,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.developertutorials.com/blog/general/create-a-custom-firefox-search-tool-in-five-minutes-325/&amp;title=Create+a+Custom+Firefox+Search+Tool+in+Five+Minutes" rel="nofollow" title="Add to&nbsp;digg"><img class="social_img" src="http://www.developertutorials.com/blog/wp-content/plugins/social-bookmarks/images/digg.png" title="Add to&nbsp;digg" alt="Add to&nbsp;digg" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit.php?url=http://www.developertutorials.com/blog/general/create-a-custom-firefox-search-tool-in-five-minutes-325/&amp;title=Create+a+Custom+Firefox+Search+Tool+in+Five+Minutes" rel="nofollow" title="Add to&nbsp;Stumble Upon"><img class="social_img" src="http://www.developertutorials.com/blog/wp-content/plugins/social-bookmarks/images/stumbleupon.png" title="Add to&nbsp;Stumble Upon" alt="Add to&nbsp;Stumble Upon" /></a>
<br />
<a style="font-size:90%;text-align: right; " title="Click me to hide the sites." href="#" onclick="$$('div.d325').each( function(e) { e.visualEffect('slide_up',{duration:0.5}) }); return false;">Hide Sites</a>
</div>
</div>
<!-- Social Bookmarks END -->
]]></content:encoded>
			<wfw:commentRss>http://www.developertutorials.com/blog/general/create-a-custom-firefox-search-tool-in-five-minutes-325/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Selenium IDE: Front-end web application testing</title>
		<link>http://www.developertutorials.com/blog/web/selenium-ide-front-end-web-application-testing-322/</link>
		<comments>http://www.developertutorials.com/blog/web/selenium-ide-front-end-web-application-testing-322/#comments</comments>
		<pubDate>Fri, 11 Jul 2008 09:00:22 +0000</pubDate>
		<dc:creator>Akash Mehta</dc:creator>
				<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://www.developertutorials.com/blog/web/selenium-ide-front-end-web-application-testing-322/</guid>
		<description><![CDATA[Ever setup a demo for a client, only to find you had a syntax error in one of the key files? Or maybe you&#8217;ve forgotten to setup the database on the staging server and your boss is staring at a screen of MySQL errors. In this tutorial, I&#8217;ll show you how to put together a [...]]]></description>
			<content:encoded><![CDATA[<p>Ever setup a demo for a client, only to find you had a syntax error in one of the key files? Or maybe you&#8217;ve forgotten to setup the database on the staging server and your boss is staring at a screen of MySQL errors. In this tutorial, I&#8217;ll show you how to put together a simple frontend-based test suite using Selenium, to help identify these issues sooner than later.<span id="more-322"></span></p>
<p>The Selenium project provides a set of tools to handle the testing of web applications. Selenium itself is simply a portable software testing framework, where the tests can be written in HTML or a programming/scripting language. The difference with Selenium is that tests are run directly within a web browser, &#8220;just like real users do.&#8221;</p>
<p>As a result, Selenium are very much oriented towards client-side results. For example, one of the simplest tests you can run in Selenium is loading a URL and checking if a certain snippet of text is or isn&#8217;t on the page. Selenium offers a number of applications built around the same standard, but we&#8217;re interested in Selenium IDE, a Firefox extension that allows tests to be developed and run from within Firefox with no additional software installation.</p>
<p>To get started with Selenium, just head over to <a href="https://addons.mozilla.org/firefox/2079/">the addon page to download Selenium IDE</a>. Once you&#8217;ve installed it, restart Firefox and find Selenium in your Tools menu. Load it up, and find an application you want to practice on &#8211; one of your pet projects, maybe, or a website you frequently visit. Because Selenium runs on top of a standard web browser, it doesn&#8217;t care what you test, as long as it has HTML to work with.</p>
<p>The moment you start Selenium IDE, it starts recording commands. Selenium testing is composed of &#8220;test suites&#8221;, of which you may have one per application. Each suite includes cases, one of which has been created already and helpfully titled &#8220;Untitled&#8221;, and each cases consists of a series of commands to be executed in succession. When you start navigating around the current page, Selenium IDE will add those navigation procedures to the current test case, so that they can be replayed at a later stage. Start by clicking on a link; you&#8217;ll see a &#8220;clickAndWait&#8221; appear in the table panel of your Selenium window.</p>
<p>To create your Selenium tests, you can simply navigate around your website while recording. Selenium records everything from clicking links to entering data in input fields and submitting forms. To stop recording, hit the red circle in the top-right. At a basic level, this tests that your pages are being served correctly. You can then add in commands within the table &#8211; I suggest starting with &#8220;verifyTextPresent&#8221; to check if a snippet of text is found within the page (expressions allowed).</p>
<p>Once you&#8217;re finished, your test window might look something like this:</p>
<p><img src="http://www.developertutorials.com/blog/wp-content/uploads/2008/07/selenium1.png" alt="" title="Selenium IDE Test Window" width="400" height="429" class="alignnone size-full wp-image-323" /></p>
<p>To run your tests, just hit the green play buttons &#8211; you may need to slow down Selenium to wait for pages to load if you&#8217;re running tests over the internet. Remember that some of Selenium&#8217;s tests are based on the DOM, and will fail if the DOM hasn&#8217;t loaded yet even if the application is running fine.</p>
<p>To save your tests to run them later, just use the File menu. In future posts, we&#8217;ll look at more complex use of Selenium and the multitude of custom commands available. In the meantime, why not subscribe to our RSS feed?</p>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a title="Click me to see the sites." href="#" onclick="$$('div.d322').each( function(e) { e.visualEffect('slide_down',{duration:2.5}) }); return false;"><strong><em>Bookmark It</em></strong></a>
<br />
<div class="d322" style="overflow:hidden">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http://www.developertutorials.com/blog/web/selenium-ide-front-end-web-application-testing-322/&amp;title=Selenium+IDE%3A+Front-end+web+application+testing" rel="nofollow" title="Add to&nbsp;Del.icio.us"><img class="social_img" src="http://www.developertutorials.com/blog/wp-content/plugins/social-bookmarks/images/delicious.png" title="Add to&nbsp;Del.icio.us" alt="Add to&nbsp;Del.icio.us" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,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.developertutorials.com/blog/web/selenium-ide-front-end-web-application-testing-322/&amp;title=Selenium+IDE%3A+Front-end+web+application+testing" rel="nofollow" title="Add to&nbsp;digg"><img class="social_img" src="http://www.developertutorials.com/blog/wp-content/plugins/social-bookmarks/images/digg.png" title="Add to&nbsp;digg" alt="Add to&nbsp;digg" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit.php?url=http://www.developertutorials.com/blog/web/selenium-ide-front-end-web-application-testing-322/&amp;title=Selenium+IDE%3A+Front-end+web+application+testing" rel="nofollow" title="Add to&nbsp;Stumble Upon"><img class="social_img" src="http://www.developertutorials.com/blog/wp-content/plugins/social-bookmarks/images/stumbleupon.png" title="Add to&nbsp;Stumble Upon" alt="Add to&nbsp;Stumble Upon" /></a>
<br />
<a style="font-size:90%;text-align: right; " title="Click me to hide the sites." href="#" onclick="$$('div.d322').each( function(e) { e.visualEffect('slide_up',{duration:0.5}) }); return false;">Hide Sites</a>
</div>
</div>
<!-- Social Bookmarks END -->
]]></content:encoded>
			<wfw:commentRss>http://www.developertutorials.com/blog/web/selenium-ide-front-end-web-application-testing-322/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Migrating legacy PHP 4 applications to PHP 5</title>
		<link>http://www.developertutorials.com/blog/javascript/migrating-legacy-php-4-applications-to-php-5-320/</link>
		<comments>http://www.developertutorials.com/blog/javascript/migrating-legacy-php-4-applications-to-php-5-320/#comments</comments>
		<pubDate>Thu, 10 Jul 2008 06:00:34 +0000</pubDate>
		<dc:creator>Akash Mehta</dc:creator>
				<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://www.developertutorials.com/blog/javascript/migrating-legacy-php-4-applications-to-php-5-320/</guid>
		<description><![CDATA[As Ivo Jansch pointed out on the Ibuildings blog, there&#8217;s barely a month left till security fixes are discontinued for PHP 4. While support for PHP 4 officially ended last December, security updates were offered until 08-08-08. Most major web hosts have been phasing out PHP 4 support, but many legacy applications built with PHP [...]]]></description>
			<content:encoded><![CDATA[<p>As Ivo Jansch pointed out on the Ibuildings blog, there&#8217;s barely a month left till security fixes are discontinued for PHP 4. While support for PHP 4 officially ended last December, security updates were offered until 08-08-08. Most major web hosts have been phasing out PHP 4 support, but many legacy applications built with PHP 4 in mind are currently in use, and the more intricate will take quite some time to move to PHP 5. Here are some tips and resources for managing the migration process.<span id="more-320"></span></p>
<p>PHP 5 supports most of the legacy syntax features of PHP 4. Most code written for PHP 4 should function fine under PHP 5, and a comprehensive test suite could check this. However, many of the backwards-incompatible changes in PHP 5 were in regard to language quirks, and quite a few hacks rely on these in order to function. Here are some issues to watch out for:</p>
<ul>
<li>Class names provided by language features &#8211; get_class(), get_parent_class()  and get_class_methods() now return the name of the classes/methods exactly as declared; earlier, they were lowercased first</li>
<li>The new object model is quite different &#8211; an empty object is no longer considered &#8220;empty&#8221; by empty(), among other changes</li>
<li>Files with functions cannot be included twice; PHP 5 throws an error as the function is being redeclared</li>
<li>Illegal uses of string offsets (e.g. $somestring[0]) will throw an error</li>
<li>On Windows servers, the include/require_once functions are case insensitive &#8211; &#8220;SomeFile.php&#8221; and &#8220;somefile.php&#8221; will only be included once</li>
</ul>
<p>Legacy applications making use of the CLI, especially under Windows, should be aware of the new names for binaries. The CGI binary has been renamed to php-cgi (previously php), while the CLI binary has been moved back into the main directory as php. Other applications calling PHP scripts may also want to look at php-win on Windows, which serves the same function as the CLI except without the black &#8220;DOS box&#8221;.</p>
<p>Finally, there are some new reserved keywords. If you are upgrading straight to PHP 5.3, watch out for the new namespace keywords, including &#8220;namespace&#8221;, &#8220;use&#8221; and __NAMESPACE__. The new OOP features introduce quite a few keywords popular in enterprise applications &#8211; &#8220;public&#8221;, &#8220;private&#8221;, &#8220;protected&#8221;, &#8220;clone&#8221;, &#8220;try&#8221; and &#8220;this&#8221; come to mind (more available <a href="http://www.php.net/manual/en/reserved.php#reserved.keywords">here</a>). Error checking every file (run &#8220;php -l /path/to/file.php&#8221;) can pick these up fair quickly.</p>
<p>PHP 4 has been discontinued for some time; indeed, the latest release, 4.4.8, is from early January. Major legacy applications should be ported as quickly as possible to avoid security issues; existing code should be thoroughly checked for syntax and language feature changes as well. The PHP manual has some <a href="http://www.php.net/manual/en/migration5.php">handy documentation on migrating</a>, and the PHP 5 features are clearly noted all around the manual &#8211; check the revision history of functions as well.</p>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a title="Click me to see the sites." href="#" onclick="$$('div.d320').each( function(e) { e.visualEffect('slide_down',{duration:2.5}) }); return false;"><strong><em>Bookmark It</em></strong></a>
<br />
<div class="d320" style="overflow:hidden">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http://www.developertutorials.com/blog/javascript/migrating-legacy-php-4-applications-to-php-5-320/&amp;title=Migrating+legacy+PHP+4+applications+to+PHP+5" rel="nofollow" title="Add to&nbsp;Del.icio.us"><img class="social_img" src="http://www.developertutorials.com/blog/wp-content/plugins/social-bookmarks/images/delicious.png" title="Add to&nbsp;Del.icio.us" alt="Add to&nbsp;Del.icio.us" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,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.developertutorials.com/blog/javascript/migrating-legacy-php-4-applications-to-php-5-320/&amp;title=Migrating+legacy+PHP+4+applications+to+PHP+5" rel="nofollow" title="Add to&nbsp;digg"><img class="social_img" src="http://www.developertutorials.com/blog/wp-content/plugins/social-bookmarks/images/digg.png" title="Add to&nbsp;digg" alt="Add to&nbsp;digg" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit.php?url=http://www.developertutorials.com/blog/javascript/migrating-legacy-php-4-applications-to-php-5-320/&amp;title=Migrating+legacy+PHP+4+applications+to+PHP+5" rel="nofollow" title="Add to&nbsp;Stumble Upon"><img class="social_img" src="http://www.developertutorials.com/blog/wp-content/plugins/social-bookmarks/images/stumbleupon.png" title="Add to&nbsp;Stumble Upon" alt="Add to&nbsp;Stumble Upon" /></a>
<br />
<a style="font-size:90%;text-align: right; " title="Click me to hide the sites." href="#" onclick="$$('div.d320').each( function(e) { e.visualEffect('slide_up',{duration:0.5}) }); return false;">Hide Sites</a>
</div>
</div>
<!-- Social Bookmarks END -->
]]></content:encoded>
			<wfw:commentRss>http://www.developertutorials.com/blog/javascript/migrating-legacy-php-4-applications-to-php-5-320/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jGrowl, an OS X Growl-like jQuery message plugin</title>
		<link>http://www.developertutorials.com/blog/javascript/jgrowl-an-os-x-growl-like-jquery-message-plugin-319/</link>
		<comments>http://www.developertutorials.com/blog/javascript/jgrowl-an-os-x-growl-like-jquery-message-plugin-319/#comments</comments>
		<pubDate>Tue, 08 Jul 2008 09:00:52 +0000</pubDate>
		<dc:creator>Akash Mehta</dc:creator>
				<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://www.developertutorials.com/blog/javascript/jgrowl-an-os-x-growl-like-jquery-message-plugin-319/</guid>
		<description><![CDATA[jGrowl is a plugin for the jQuery that generates unobtrusive notification boxes on a page. It has a similar design to the OS X Growl Framework, after which it is named. With jGrowl, web developers can easily display brief information messages and alerts to their users during busy sessions with complex web applications.
jGrowl integrates cleanly [...]]]></description>
			<content:encoded><![CDATA[<p>jGrowl is a plugin for the <a href="http://jquery.com/" target="_blank">jQuery</a> that generates unobtrusive notification boxes on a page. It has a similar design to the OS X <a href="http://growl.info/" target="_blank">Growl Framework</a>, after which it is named. With jGrowl, web developers can easily display brief information messages and alerts to their users during busy sessions with complex web applications.<span id="more-319"></span></p>
<p><a href="http://stanlemon.net/projects/jgrowl.html" target="_blank">jGrowl</a> integrates cleanly into jQuery, offering a simple API for displaying messages. By default, the message is displayed in an elegant black box for a few seconds, with a close button for the user to hide it manually. However, as expected of a jQuery API, the plugin also has a wealth of options to configure its behaviour, accepting parameters in JSON format.</p>
<p>Each message can be configured to be &#8220;stickied&#8221; &#8211; that is, to remain in place until dismissed by the user. New messages can also be added to the beginning of the stack, as opposed to the end, in a case where one or more jGrowl messages may already be visible. A number of options for configuring visual appearance are available, and jGrowl can use a specified CSS class as well, giving the developer full control over the final display. Message transitions are animated, and the animation effect can also be configured.</p>
<p>The API also features a number of powerful hooks, providing events on which user-defined functions can be fired &#8211; also passed in through the JSON configurations. For example, functions can be fired before and on opening and closing each message, as well as during the open animation and close animation.</p>
<p>Two versions are available, one recommended for jQuery 1.0.x, the other for jQuery 1.2.x, so jGrowl should be compatible with your existing jQuery-powered application. The standard download includes extensive samples, and it&#8217;s very easy to get started. Head over to the project page, or the <a href="http://plugins.jquery.com/project/jgrowl" target="_blank">jQuery plugin page</a> for further details.</p>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a title="Click me to see the sites." href="#" onclick="$$('div.d319').each( function(e) { e.visualEffect('slide_down',{duration:2.5}) }); return false;"><strong><em>Bookmark It</em></strong></a>
<br />
<div class="d319" style="overflow:hidden">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http://www.developertutorials.com/blog/javascript/jgrowl-an-os-x-growl-like-jquery-message-plugin-319/&amp;title=jGrowl%2C+an+OS+X+Growl-like+jQuery+message+plugin" rel="nofollow" title="Add to&nbsp;Del.icio.us"><img class="social_img" src="http://www.developertutorials.com/blog/wp-content/plugins/social-bookmarks/images/delicious.png" title="Add to&nbsp;Del.icio.us" alt="Add to&nbsp;Del.icio.us" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,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.developertutorials.com/blog/javascript/jgrowl-an-os-x-growl-like-jquery-message-plugin-319/&amp;title=jGrowl%2C+an+OS+X+Growl-like+jQuery+message+plugin" rel="nofollow" title="Add to&nbsp;digg"><img class="social_img" src="http://www.developertutorials.com/blog/wp-content/plugins/social-bookmarks/images/digg.png" title="Add to&nbsp;digg" alt="Add to&nbsp;digg" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit.php?url=http://www.developertutorials.com/blog/javascript/jgrowl-an-os-x-growl-like-jquery-message-plugin-319/&amp;title=jGrowl%2C+an+OS+X+Growl-like+jQuery+message+plugin" rel="nofollow" title="Add to&nbsp;Stumble Upon"><img class="social_img" src="http://www.developertutorials.com/blog/wp-content/plugins/social-bookmarks/images/stumbleupon.png" title="Add to&nbsp;Stumble Upon" alt="Add to&nbsp;Stumble Upon" /></a>
<br />
<a style="font-size:90%;text-align: right; " title="Click me to hide the sites." href="#" onclick="$$('div.d319').each( function(e) { e.visualEffect('slide_up',{duration:0.5}) }); return false;">Hide Sites</a>
</div>
</div>
<!-- Social Bookmarks END -->
]]></content:encoded>
			<wfw:commentRss>http://www.developertutorials.com/blog/javascript/jgrowl-an-os-x-growl-like-jquery-message-plugin-319/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
