<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="/css/rss20.xsl" type="text/xsl"?>
<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/" xmlns:pheedo="http://www.pheedo.com/namespace/pheedo">
	<channel>
		<title>SitePoint » Learn CSS &#124; HTML5 &#124; JavaScript &#124; Wordpress &#124; Tutorials-Web Development &#124; Reference &#124; Books and More &#187; PHP</title>
		<atom:link href="http://www.sitepoint.com/category/php/feed/" rel="self" type="application/rss+xml"/>
		<link>http://www.sitepoint.com</link>
		<description></description>
		<lastBuildDate>Wed, 16 May 2012 15:00:34 +0000</lastBuildDate>
		<language>en</language>
		<sy:updatePeriod>hourly</sy:updatePeriod>
		<sy:updateFrequency>1</sy:updateFrequency>
		<generator>http://wordpress.org/?v=3.3.1</generator>
		<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex"/>
		<item>
			<title>XSS Attacks, Redis DB, REST, and More</title>
			<link>http://www.pheedcontent.com/click.phdo?i=3ee64dd899cf8b32d02fec7957942a4e</link>
			<pheedo:origLink>http://www.sitepoint.com/xss-attacks-redis-db-rest-and-more/?utm_source=rss&amp;#038;utm_medium=rss&amp;#038;utm_campaign=xss-attacks-redis-db-rest-and-more</pheedo:origLink>
			<comments>http://www.sitepoint.com/xss-attacks-redis-db-rest-and-more/#comments</comments>
			<pubDate>Wed, 09 May 2012 05:25:33 +0000</pubDate>
			<dc:creator>Timothy Boronczyk</dc:creator>
			<category><![CDATA[PHP]]></category>
			<guid
isPermaLink="false">http://www.sitepoint.com/?p=54470</guid>
			<description><![CDATA[<img
width="50" height="15" src="http://www.sitepoint.com/wp-content/uploads/1/files/2012/03/phpmaster-50x15.png" class="attachment-thumbnail wp-post-image" alt="phpmaster" title="phpmaster" />on PHPMaster, we present tutorials on protecting yourself from cross-site scripting attacks, using Redis with the Predis library, understanding REST, using an Access database with PHP, and working with text and CSV files. Be sure to visit phpmaster.com for more great articles!<br clear="both" style="clear: both;"/>
<br clear="both" style="clear: both;"/>
<a href="http://ads.pheedo.com/click.phdo?s=3ee64dd899cf8b32d02fec7957942a4e&p=1"><img alt="" style="border: 0;" border="0" src="http://ads.pheedo.com/img.phdo?s=3ee64dd899cf8b32d02fec7957942a4e&p=1"/></a>
<img alt="" height="0" width="0" border="0" style="display:none" src="http://tags.bluekai.com/site/5148"/><img alt="" height="0" width="0" border="0" style="display:none" src="http://insight.adsrvr.org/track/evnt/?ct=0:8pyu3gz&adv=wouzn4v&fmt=3"/>]]></description>
			<content:encoded><![CDATA[<img
width="50" height="15" src="http://www.sitepoint.com/wp-content/uploads/1/files/2012/03/phpmaster-50x15.png" class="attachment-thumbnail wp-post-image" alt="phpmaster" title="phpmaster" /><p></p><h2><a
href="http://phpmaster.com/php-security-cross-site-scripting-attacks-xss/">PHP Security: Cross-site Scripting Attacks (XSS)</a></h2><p>Every PHP programmer has the responsibility to understand how attacks can be carried out against their code to exploit possible security vulnerabilities. Learn about cross-site scripting (XSS) attacks and how you can prevent them in your PHP scripts.</p><hr
/><h2><a
href="http://phpmaster.com/an-introduction-to-redis-in-php-using-predis/">An Introduction to Redis in PHP Using Predis</a></h2><p>Redis is an open-source data structure server with an in-memory data set that does much more than simple key/value storage. This article introduces you to some of the basic yet powerful commands that Redis has to offer using the Predis library.</p><hr
/><h2><a
href="http://phpmaster.com/rest-can-you-do-more-than-spell-it-1/">REST: Can you do more than spell it?</a></h2><p>Though you&#8217;ll often see the words &#8220;REST&#8221; and &#8220;architecture&#8221; together, REST is not a specific architecture. This four-part series introduces you to REST, a set of principles that define how a server and client can communicate with each other (and external resources) in a straightforward and robust manner.</p><hr
/><h2><a
href="http://phpmaster.com/using-an-access-database-with-php/">Using an Access database with PHP</a></h2><p>Sometimes a client will already have a database and ask that we make it available on the Web, and sometimes that database is in Access. Never fear, for PHP can easily work with Access databases using an ODBC driver. Learn the essential elements you&#8217;ll need to put an existing Access database online.<div
id='div-gpt-ad-1328644474660-10' style='width:728px; height:90px;'> <script type='text/javascript'>googletag.cmd.push(function() { googletag.display('div-gpt-ad-1328644474660-10'); });</script> </div></p><hr
/><h2><a
href="http://phpmaster.com/working-with-files-in-php/">Working with Files in PHP</a></h2><p>You&#8217;re familiar with databases such as MySQL and Access, but data can also be stored in files. This article gives you an introduction into working with text and CSV files, as well as find out information about the files (such as permissions and the last time it was modified).</p><hr
/> <span
id="pty_trigger"></span><div
style='padding:20px 0px 50px 0px;'><div
style='float:left;padding-left:40px;'><div
id='div-gpt-ad-1335489406190-0' style='width:300px; height:100px;'> <script type='text/javascript'>googletag.cmd.push(function() { googletag.display('div-gpt-ad-1335489406190-0'); });</script> </div></div><div
style='float:right;padding-right:40px;'><div
id='div-gpt-ad-1335489406190-1' style='width:300px; height:100px;'> <script type='text/javascript'>googletag.cmd.push(function() { googletag.display('div-gpt-ad-1335489406190-1'); });</script> </div></div><div
style='clear:both'></div></div><div
style='clear:both'></div><br clear="both" style="clear: both;"/>
<br clear="both" style="clear: both;"/>
<a href="http://ads.pheedo.com/click.phdo?s=3ee64dd899cf8b32d02fec7957942a4e&p=1"><img alt="" style="border: 0;" border="0" src="http://ads.pheedo.com/img.phdo?s=3ee64dd899cf8b32d02fec7957942a4e&p=1"/></a>
<img alt="" height="0" width="0" border="0" style="display:none" src="http://tags.bluekai.com/site/5148"/><img alt="" height="0" width="0" border="0" style="display:none" src="http://insight.adsrvr.org/track/evnt/?ct=0:8pyu3gz&adv=wouzn4v&fmt=3"/>]]></content:encoded>
			<wfw:commentRss>http://www.sitepoint.com/xss-attacks-redis-db-rest-and-more/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		</item>
		<item>
			<title>Watch Kevin Yank Introduce his NEW book &#8220;PHP &amp; MYSQL: Novice to Ninja&#8221;</title>
			<link>http://www.pheedcontent.com/click.phdo?i=7684d786238d08652cf56378628fdbac</link>
			<pheedo:origLink>http://www.sitepoint.com/watch-kevin-yank-introduce-his-new-book-php-mysql-novice-to-ninja/?utm_source=rss&amp;#038;utm_medium=rss&amp;#038;utm_campaign=watch-kevin-yank-introduce-his-new-book-php-mysql-novice-to-ninja</pheedo:origLink>
			<comments>http://www.sitepoint.com/watch-kevin-yank-introduce-his-new-book-php-mysql-novice-to-ninja/#comments</comments>
			<pubDate>Thu, 03 May 2012 05:42:39 +0000</pubDate>
			<dc:creator>Mick Gibson</dc:creator>
			<category><![CDATA[Open Source]]></category>
			<category><![CDATA[PHP]]></category>
			<category><![CDATA[PHP & MySQL News & Interviews]]></category>
			<category><![CDATA[PHP & MySQL Reviews and Apps]]></category>
			<category><![CDATA[PHP & MySQL Tutorials]]></category>
			<category><![CDATA[Server Side Coding]]></category>
			<category><![CDATA[Server Side Essentials]]></category>
			<guid
isPermaLink="false">http://www.sitepoint.com/?p=54224</guid>
			<description><![CDATA[<img
width="50" height="30" src="http://www.sitepoint.com/wp-content/uploads/1/files/2012/05/Screen-shot-2012-05-03-at-3.37.51-PM-50x30.png" class="attachment-thumbnail wp-post-image" alt="Screen shot 2012-05-03 at 3.37.51 PM" title="Screen shot 2012-05-03 at 3.37.51 PM" />&#8221; &#8230; Just as PHP and MySQL have grown from the young upstarts of the web development world into mature, stable platforms for billion-dollar businesses, this book that I’ve been writing again and again for over a decade has grown up &#8230; It’s time to write PHP like the big kids do…&#8221;  This is how Kevin Yank [...]<br clear="both" style="clear: both;"/>
<br clear="both" style="clear: both;"/>
<a href="http://ads.pheedo.com/click.phdo?s=7684d786238d08652cf56378628fdbac&p=1"><img alt="" style="border: 0;" border="0" src="http://ads.pheedo.com/img.phdo?s=7684d786238d08652cf56378628fdbac&p=1"/></a>
<img alt="" height="0" width="0" border="0" style="display:none" src="http://tags.bluekai.com/site/5148"/><img alt="" height="0" width="0" border="0" style="display:none" src="http://insight.adsrvr.org/track/evnt/?ct=0:8pyu3gz&adv=wouzn4v&fmt=3"/>]]></description>
			<content:encoded><![CDATA[<img
width="50" height="30" src="http://www.sitepoint.com/wp-content/uploads/1/files/2012/05/Screen-shot-2012-05-03-at-3.37.51-PM-50x30.png" class="attachment-thumbnail wp-post-image" alt="Screen shot 2012-05-03 at 3.37.51 PM" title="Screen shot 2012-05-03 at 3.37.51 PM" /><p></p><p><em>&#8221; &#8230; Just as PHP and MySQL have grown from the young upstarts of the web development world into mature, stable platforms for billion-dollar businesses, this book that I’ve been writing again and again for over a decade has grown up &#8230; It’s time to write PHP like the big kids do…&#8221; </em></p><p>This is how Kevin Yank describes the 5th edition of his just-released book &#8220;<a
href="http://www.sitepoint.com/launch/d724a6">PHP &amp; MYSQL: Novice to Ninja</a>&#8220;</p><p>Watch Kevin as he introduces you to his NEW book!</p><p><iframe
src="http://player.vimeo.com/video/41422400?byline=0&amp;portrait=0" frameborder="0" width="600" height="338"></iframe></p><p><strong>As part of the launch of Kevin&#8217;s book, it&#8217;s now on special with &#8211; <a
href="http://www.sitepoint.com/launch/d724a6 ">SAVINGS of up to 50%</a></strong></p><p>&nbsp;</p><p>&nbsp;</p> <span
id="pty_trigger"></span><div
style='padding:20px 0px 50px 0px;'><div
style='float:left;padding-left:40px;'><div
id='div-gpt-ad-1335489406190-0' style='width:300px; height:100px;'> <script type='text/javascript'>googletag.cmd.push(function() { googletag.display('div-gpt-ad-1335489406190-0'); });</script> </div></div><div
style='float:right;padding-right:40px;'><div
id='div-gpt-ad-1335489406190-1' style='width:300px; height:100px;'> <script type='text/javascript'>googletag.cmd.push(function() { googletag.display('div-gpt-ad-1335489406190-1'); });</script> </div></div><div
style='clear:both'></div></div><div
style='clear:both'></div><br clear="both" style="clear: both;"/>
<br clear="both" style="clear: both;"/>
<a href="http://ads.pheedo.com/click.phdo?s=7684d786238d08652cf56378628fdbac&p=1"><img alt="" style="border: 0;" border="0" src="http://ads.pheedo.com/img.phdo?s=7684d786238d08652cf56378628fdbac&p=1"/></a>
<img alt="" height="0" width="0" border="0" style="display:none" src="http://tags.bluekai.com/site/5148"/><img alt="" height="0" width="0" border="0" style="display:none" src="http://insight.adsrvr.org/track/evnt/?ct=0:8pyu3gz&adv=wouzn4v&fmt=3"/>]]></content:encoded>
			<wfw:commentRss>http://www.sitepoint.com/watch-kevin-yank-introduce-his-new-book-php-mysql-novice-to-ninja/feed/</wfw:commentRss>
			<slash:comments>8</slash:comments>
		</item>
		<item>
			<title>Sneak Peek at Kevin Yank&#8217;s New Book &#8216;PHP &amp; MYSQL: Novice to Ninja&#8217;</title>
			<link>http://www.pheedcontent.com/click.phdo?i=47a8a8b35c6164e20b995c18dd5ff084</link>
			<pheedo:origLink>http://www.sitepoint.com/sneak-peek-of-kevin-yanks-new-php-mysql-book/?utm_source=rss&amp;#038;utm_medium=rss&amp;#038;utm_campaign=sneak-peek-of-kevin-yanks-new-php-mysql-book</pheedo:origLink>
			<comments>http://www.sitepoint.com/sneak-peek-of-kevin-yanks-new-php-mysql-book/#comments</comments>
			<pubDate>Thu, 26 Apr 2012 06:01:19 +0000</pubDate>
			<dc:creator>Mick Gibson</dc:creator>
			<category><![CDATA[PHP]]></category>
			<category><![CDATA[PHP & MySQL News & Interviews]]></category>
			<category><![CDATA[PHP & MySQL Reviews and Apps]]></category>
			<category><![CDATA[PHP & MySQL Tutorials]]></category>
			<category><![CDATA[Server Side Coding]]></category>
			<category><![CDATA[Server Side Essentials]]></category>
			<category><![CDATA[Tutorial]]></category>
			<category><![CDATA[Tutorials]]></category>
			<category><![CDATA[Web Tech]]></category>
			<guid
isPermaLink="false">http://www.sitepoint.com/?p=53890</guid>
			<description><![CDATA[<img
width="50" height="43" src="http://www.sitepoint.com/wp-content/uploads/1/files/2012/04/php-mysql-50x43.png" class="attachment-thumbnail wp-post-image" alt="php-mysql" title="php-mysql" />Kevin Yank&#8217;s done it again! He&#8217;s just completed a new 2012 edition of his best-selling book (Build Your Own Database Driven Web Site, 4th Edition) which is now titled - PHP &#38; MySQL: Novice to Ninja. And, today you can: Take a sneak peek inside the book (with an excerpt from the Chapter 3 -Introducing PHP) Order the [...]<br clear="both" style="clear: both;"/>
<br clear="both" style="clear: both;"/>
<a href="http://ads.pheedo.com/click.phdo?s=47a8a8b35c6164e20b995c18dd5ff084&p=1"><img alt="" style="border: 0;" border="0" src="http://ads.pheedo.com/img.phdo?s=47a8a8b35c6164e20b995c18dd5ff084&p=1"/></a>
<img alt="" height="0" width="0" border="0" style="display:none" src="http://tags.bluekai.com/site/5148"/><img alt="" height="0" width="0" border="0" style="display:none" src="http://insight.adsrvr.org/track/evnt/?ct=0:8pyu3gz&adv=wouzn4v&fmt=3"/>]]></description>
			<content:encoded><![CDATA[<img
width="50" height="43" src="http://www.sitepoint.com/wp-content/uploads/1/files/2012/04/php-mysql-50x43.png" class="attachment-thumbnail wp-post-image" alt="php-mysql" title="php-mysql" /><p></p><p><a
href="http://www.sitepoint.com/?attachment_id=53906" rel="attachment wp-att-53906"><img
class="alignright size-full wp-image-53906" title="phpmysql5-cover" src="http://www.sitepoint.com/wp-content/uploads/1/files/2012/04/phpmysql5-cover.jpg" alt="phpmysql5-cover" width="200" height="267" /></a>Kevin Yank&#8217;s done it again! He&#8217;s just completed a new 2012 edition of his best-selling book (<em>Build Your Own Database Driven Web Site, 4th Edition</em>) which is now titled - <em>PHP &amp; MySQL: Novice to Ninja. </em>And, today you can:</p><ul><li><strong>Take a sneak peek inside the book</strong> (with an excerpt from the Chapter 3 -<em>Introducing PHP</em>)</li><li><strong><a
href="#pre-order">Order the book</a></strong>, and SAVE up to 50%</li></ul><div>Now let&#8217;s jump into the excerpt from the book. Over to you Kev &#8230;</div><div></div><h2>Introducing PHP</h2><p>PHP is a <strong>server-side language</strong>. This concept may be a little difficult to grasp, especially if you’ve only ever designed websites using client-side languages like HTML, CSS, and JavaScript.</p><p>A server-side language is similar to JavaScript in that it allows you to embed little</p><p>programs (scripts) into the HTML code of a web page. When executed, these programs give you greater control over what appears in the browser window than HTML alone can provide. The key difference between JavaScript and PHP is the stage of loading the web page at which these embedded programs are executed.</p><p>Client-side languages like JavaScript are read and executed by the web browser after downloading the web page (embedded programs and all) from the web server. In contrast, server-side languages like PHP are run by the web <em>server</em>, before sending the web page to the browser. Whereas client-side languages give you control over how a page behaves once it’s displayed by the browser, server-side languages let you generate customized pages on the fly before they’re even sent to the browser.</p><p>Once the web server has executed the PHP code embedded in a web page, the result takes the place of the PHP code in the page. All the browser sees is standard HTML code when it receives the page, hence the name “server-side language.” Let’s look back at the today.php example presented in Chapter 1:</p><pre>&lt;!DOCTYPE html&gt;
&lt;html lang="en"&gt;
&lt;head&gt;
&lt;meta charset="utf-8"&gt;
&lt;title&gt;Today&amp;rsquo;s Date&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;p&gt;Today&amp;rsquo;s date (according to this web server) is
<strong>&lt;?php </strong>
<strong>echo date('l, F jS Y.'); </strong>
<strong>?&gt; </strong>
&lt;/p&gt;
&lt;/body&gt;
&lt;/html&gt;</pre><p>Most of this is plain HTML except the line between &lt;?php and ?&gt; is PHP code. &lt;?php marks the start of an embedded PHP script and ?&gt; marks its end. The web server is asked to interpret everything between these two delimiters and convert it to regular HTML code before it sends the web page to the requesting browser. The browser is presented with the following:</p><p>Notice that all signs of the PHP code have disappeared. In its place the output of the script has appeared, and it looks just like standard HTML. This example demonstrates several advantages of server-side scripting:</p><pre>&lt;!DOCTYPE html&gt;
&lt;html lang="en"&gt;
&lt;head&gt;
&lt;meta charset="utf-8"&gt;
&lt;title&gt;Today&amp;rsquo;s Date&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;p&gt;Today&amp;rsquo;s date (according to this web server) is
<strong>Sunday, April 1st 2012. </strong>&lt;/p&gt;
&lt;/body&gt;
&lt;/html&gt;</pre><p>Notice that all signs of the PHP code have disappeared. In its place the output of the script has appeared, and it looks just like standard HTML. This example demonstrates several advantages of server-side scripting:</p><h3>No browser compatibility issues</h3><p>PHP scripts are interpreted by the web server alone, so there’s no need to worry about whether the language features you’re using are supported by the visitor’s browser.</p><h3>Access to server-side resources</h3><p>In the above example, we placed the date according to the web server into the web page. If we had inserted the date using JavaScript, we’d only be able to display the date according to the computer on which the web browser was running. Granted, there are more impressive examples of the exploitation of server-side resources, such as inserting content pulled out of a MySQL database (<em>hint, hint …</em>).</p><h3>Reduced load on the client</h3><p>JavaScript can delay the display of a web page significantly (especially on mobile devices!), as the browser must run the script before it can display the web page. With server-side code this burden is passed to the web server, which you can make as beefy as your application requires (and your wallet can afford).</p><h2>Basic Syntax and Statements</h2><p>PHP syntax will be very familiar to anyone with an understanding of JavaScript, C, C++, C#, Objective-C, Java, Perl, or any other C-derived language. But if these languages are unfamiliar to you, or if you’re new to programming in general, there’s no need to worry about it.</p><p>A PHP script consists of a series of commands, or <strong>statements</strong>. Each statement is an instruction that must be followed by the web server before it can proceed to the next instruction. PHP statements, like those in the aforementioned languages, are always terminated by a semicolon (;).</p><p>This is a typical PHP statement:</p><pre>echo 'This is a &lt;strong&gt;test&lt;/strong&gt;!';</pre><p>This is an echo statement, which is used to generate content (usually HTML code) to send to the browser. An echo statement simply takes the text it’s given and inserts it into the page’s HTML code at the position of the PHP script where it was contained.</p><p>In this case, we’ve supplied a string of text to be output: &#8216;This is a &lt;strong&gt;test&lt;/strong&gt;!&#8217;. Notice that the string of text contains HTML tags (&lt;strong&gt; and &lt;/strong&gt;), which is perfectly acceptable. So, if we take this statement and put it into a complete web page, here’s the resulting code:</p><pre>&lt;!DOCTYPE html&gt;
&lt;html lang="en"&gt;
&lt;head&gt;
&lt;meta charset="utf-8"&gt;
&lt;title&gt;Today&amp;rsquo;s Date&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;p&gt;<strong>&lt;?php echo 'This is a &lt;strong&gt;test&lt;/strong&gt;!'; ?&gt;</strong>&lt;/p&gt;
&lt;/body&gt;
&lt;/html&gt;</pre><p>If you place this file on your web server and then request it using a web browser, your browser will receive this HTML code:</p><pre>&lt;!DOCTYPE html&gt;
&lt;html lang="en"&gt;
&lt;head&gt;
&lt;meta charset="utf-8"&gt;
&lt;title&gt;Today&amp;rsquo;s Date&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;p&gt;<strong>This is a &lt;strong&gt;test&lt;/strong&gt;!</strong>&lt;/p&gt;
&lt;/body&gt;
&lt;/html&gt;</pre><p>The today.php example we looked at earlier contained a slightly more complex echo statement:</p><pre>echo date('l, F jS Y.');</pre><p>Instead of giving echo a simple string of text to output, this statement invokes a <strong>built-in function </strong>called date and passes <em>it </em>a string of text: &#8216;l, F jS Y.&#8217;. You can think of built-in functions as tasks that PHP knows how to do without you needing to spell out the details. PHP has many built-in functions that let you do everything, from sending email to working with information stored in various types of databases.</p><p>When you invoke a function in PHP—that is, ask it to do its job—you’re said to be <strong>calling </strong>that function. Most functions <strong>return </strong>a value when they’re called; PHP then behaves as if you’d actually just typed that returned value instead in your code. In this case, our echo statement contains a call to the date function, which returns the current date as a string of text (the format of which is specified by the text string in the function call). The echo statement therefore outputs the value returned by the function call.</p><p>You may wonder why we need to surround the string of text with both parentheses ((…)) and single quotes (&#8216;…&#8217;). As in SQL, quotes are used in PHP to mark the beginning and end of strings of text, so it makes sense for them to be there. The parentheses serve two purposes. First, they indicate that date is a function that you want to call. Second, they mark the beginning and end of a list of <strong>arguments </strong>that you wish to provide, in order to tell the function what you want it to do.</p><p>In the case of the date function, you need to provide a string of text that describes the format in which you want the date to appear. Later on, we’ll look at functions that take more than one argument, and we’ll separate those arguments with commas. We’ll also consider functions that take no arguments at all. These functions will still need the parentheses, even though there will be nothing to type between them.</p><p>&#8212;</p><p>Fantastic, thanks Kevin for sharing that!<a
href="http://www.sitepoint.com/?attachment_id=53914" rel="attachment wp-att-53914"><img
class="alignright size-full wp-image-53914" title="phpmysql5-whats-inside" src="http://www.sitepoint.com/wp-content/uploads/1/files/2012/04/phpmysql5-whats-inside.jpg" alt="phpmysql5-whats-inside" width="165" height="450" /></a></p><p>The good news is there&#8217;s loads more practical and hands-on examples just like this in the 500+ pages of the book. Which covers:</p><ul><li><strong>Tutorials</strong>: Easy-to-follow tutorials with downloadable code examples</li><li><strong>Installation:</strong> Instructions for PHP &amp; MySQL on Windows, Mac OS X, and Linux</li><li><strong>PHP coding</strong>: Learning the correct PHP syntax</li><li><strong>Database design</strong>: Mastering SQL database design</li><li><strong>Object Oriented Programming</strong> (OOP): Crash course in OOP principles.</li><li><strong>Building a CMS</strong>: Step-by-step guide to creating a CMS.</li><li><strong>Shopping Carts</strong>: Developing an e-commerce cart from scratch.<a
name="pre-order"></a></li><li><strong>Latest technologies</strong>: Updated for Windows 7, Mac OS X Lion, and the latest versions of PHP, MySQL, phpMyAdmin, XAMPP, MAMP, and HTML5.</li></ul><p>Order your copy now:</p><ul><li><strong><a
href="http://www.sitepoint.com/launch/d724a6 " target="_blank">PRINT Book + Digital EPACK Bundle &#8211; for $34</a></strong>  <strong>(SAVE 50%)</strong></li><li><a
style="font-weight: bold;" href="http://www.sitepoint.com/launch/d724a6 " target="_blank">Digital EPACK (pdf, epub, mobi) &#8211; for $17</a>  <strong>(SAVE 42%)</strong></li></ul><p>That&#8217;s it. Enjoy, and as always, we&#8217;d love to hear all your thoughts and comments.</p> <span
id="pty_trigger"></span><div
style='padding:20px 0px 50px 0px;'><div
style='float:left;padding-left:40px;'><div
id='div-gpt-ad-1335489406190-0' style='width:300px; height:100px;'> <script type='text/javascript'>googletag.cmd.push(function() { googletag.display('div-gpt-ad-1335489406190-0'); });</script> </div></div><div
style='float:right;padding-right:40px;'><div
id='div-gpt-ad-1335489406190-1' style='width:300px; height:100px;'> <script type='text/javascript'>googletag.cmd.push(function() { googletag.display('div-gpt-ad-1335489406190-1'); });</script> </div></div><div
style='clear:both'></div></div><div
style='clear:both'></div><br clear="both" style="clear: both;"/>
<br clear="both" style="clear: both;"/>
<a href="http://ads.pheedo.com/click.phdo?s=47a8a8b35c6164e20b995c18dd5ff084&p=1"><img alt="" style="border: 0;" border="0" src="http://ads.pheedo.com/img.phdo?s=47a8a8b35c6164e20b995c18dd5ff084&p=1"/></a>
<img alt="" height="0" width="0" border="0" style="display:none" src="http://tags.bluekai.com/site/5148"/><img alt="" height="0" width="0" border="0" style="display:none" src="http://insight.adsrvr.org/track/evnt/?ct=0:8pyu3gz&adv=wouzn4v&fmt=3"/>]]></content:encoded>
			<wfw:commentRss>http://www.sitepoint.com/sneak-peek-of-kevin-yanks-new-php-mysql-book/feed/</wfw:commentRss>
			<slash:comments>14</slash:comments>
		</item>
		<item>
			<title>Deploying Apps with Phing, PHP Presentations, Virtual Proxies, and More</title>
			<link>http://www.pheedcontent.com/click.phdo?i=8ab6c3748b4045ac6df6b941cab3fe2b</link>
			<pheedo:origLink>http://www.sitepoint.com/deploying-apps-with-phing-php-presentations-virtual-proxies-and-more/?utm_source=rss&amp;#038;utm_medium=rss&amp;#038;utm_campaign=deploying-apps-with-phing-php-presentations-virtual-proxies-and-more</pheedo:origLink>
			<comments>http://www.sitepoint.com/deploying-apps-with-phing-php-presentations-virtual-proxies-and-more/#comments</comments>
			<pubDate>Tue, 24 Apr 2012 17:00:38 +0000</pubDate>
			<dc:creator>Timothy Boronczyk</dc:creator>
			<category><![CDATA[PHP]]></category>
			<guid
isPermaLink="false">http://www.sitepoint.com/?p=53935</guid>
			<description><![CDATA[<img
width="50" height="15" src="http://www.sitepoint.com/wp-content/uploads/1/files/2012/03/phpmaster-50x15.png" class="attachment-thumbnail wp-post-image" alt="phpmaster" title="phpmaster" />Over on PHPMaster we've covered tutorials on deploying your apps with Phing, how to give your first PHP presentation,  maintaining your server from the command line, and plenty more.<br clear="both" style="clear: both;"/>
<br clear="both" style="clear: both;"/>
<a href="http://ads.pheedo.com/click.phdo?s=8ab6c3748b4045ac6df6b941cab3fe2b&p=1"><img alt="" style="border: 0;" border="0" src="http://ads.pheedo.com/img.phdo?s=8ab6c3748b4045ac6df6b941cab3fe2b&p=1"/></a>
<img alt="" height="0" width="0" border="0" style="display:none" src="http://tags.bluekai.com/site/5148"/><img alt="" height="0" width="0" border="0" style="display:none" src="http://insight.adsrvr.org/track/evnt/?ct=0:8pyu3gz&adv=wouzn4v&fmt=3"/>]]></description>
			<content:encoded><![CDATA[<img
width="50" height="15" src="http://www.sitepoint.com/wp-content/uploads/1/files/2012/03/phpmaster-50x15.png" class="attachment-thumbnail wp-post-image" alt="phpmaster" title="phpmaster" /><p></p><h2><a
href="http://phpmaster.com/deploy-and-release-your-applications-with-phing/">Deploy and Release your Applications with Phing</a></h2><p>In a previous article on PHPMaster, you gained a basic understanding of Phing. In this article, you&#8217;ll use that knowledge to write your own boilerplate build file, which can be customized and reused in your real-world applications.</p><hr
/><h2><a
href="http://phpmaster.com/giving-your-first-php-presentation/">Giving Your First PHP Presentation</a></h2><p>It&#8217;s public speaking time and you&#8217;re the next one up! In this article, you&#8217;ll learn why presenting PHP can be beneficial, who can present  PHP-related topics (hint: it&#8217;s not just the experts!), and what you can do to make your presentation stand out when you deliver.</p><hr
/><h2><a
href="http://phpmaster.com/maintaining-your-server-with-command-line-php/">Maintaining your Server with Command Line PHP</a></h2><p>Maintaining your Server with Command Line PHP<br
/> When maintaining a server, you need to know how to write scripts and small programs to automate tasks. Two of the biggest advantages of using PHP to write scripts are: you&#8217;re already familiar with the language, and you gain the ability to reuse any code from your previous PHP projects.</p><hr
/><h2><a
href="http://phpmaster.com/intro-to-virtual-proxies-1/">An Intro to Virtual Proxies, Part 1</a></h2><p>One of the most appealing facets of polymorphism is that it&#8217;s applicable in a wide variety of situations. Moreover, while the ability to switch out concrete implementations is a fundamental object-oriented pillar, its use is limited when involving domain objects. In this first piece of a two-part series on virtual proxies, I&#8217;ll be showcasing their use case, and later digging deeper into their complexities.<div
id='div-gpt-ad-1328644474660-10' style='width:728px; height:90px;'> <script type='text/javascript'>googletag.cmd.push(function() { googletag.display('div-gpt-ad-1328644474660-10'); });</script> </div></p><hr
/><h2><a
href="http://phpmaster.com/in-my-language-please/">Translating WordPress Themes and Plugins</a></h2><p>WordPress itself is translated into many languages, but this is not the case with themes, plugins, and other front-end customizations. All theme and plugin developers are responsible for adding translation support for their work.. This article will show you how to translate any WordPress theme or plugin by using internationalization and localization methods.</p><hr
/> <span
id="pty_trigger"></span><div
style='padding:20px 0px 50px 0px;'><div
style='float:left;padding-left:40px;'><div
id='div-gpt-ad-1335489406190-0' style='width:300px; height:100px;'> <script type='text/javascript'>googletag.cmd.push(function() { googletag.display('div-gpt-ad-1335489406190-0'); });</script> </div></div><div
style='float:right;padding-right:40px;'><div
id='div-gpt-ad-1335489406190-1' style='width:300px; height:100px;'> <script type='text/javascript'>googletag.cmd.push(function() { googletag.display('div-gpt-ad-1335489406190-1'); });</script> </div></div><div
style='clear:both'></div></div><div
style='clear:both'></div><br clear="both" style="clear: both;"/>
<br clear="both" style="clear: both;"/>
<a href="http://ads.pheedo.com/click.phdo?s=8ab6c3748b4045ac6df6b941cab3fe2b&p=1"><img alt="" style="border: 0;" border="0" src="http://ads.pheedo.com/img.phdo?s=8ab6c3748b4045ac6df6b941cab3fe2b&p=1"/></a>
<img alt="" height="0" width="0" border="0" style="display:none" src="http://tags.bluekai.com/site/5148"/><img alt="" height="0" width="0" border="0" style="display:none" src="http://insight.adsrvr.org/track/evnt/?ct=0:8pyu3gz&adv=wouzn4v&fmt=3"/>]]></content:encoded>
			<wfw:commentRss>http://www.sitepoint.com/deploying-apps-with-phing-php-presentations-virtual-proxies-and-more/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		</item>
		<div>
			<div
class="post_box two_ads" style="float:left;padding-left:2px;">
				<div
id='div-gpt-ad-1328645237920-0' style='width:728px; height:90px;'>
					<script type='text/javascript'>googletag.cmd.push(function() { googletag.display('div-gpt-ad-1328645237920-0'); });</script>
				</div>
			</div>
		</div>
		<div
class="clear">&nbsp;</div>
		<item>
			<title>6 Skills Every PHP Freelancer Needs, Pragmatic Testing, MySQL, and More</title>
			<link>http://www.pheedcontent.com/click.phdo?i=8b3ff6a53881e7de0a8c9ad40683e304</link>
			<pheedo:origLink>http://www.sitepoint.com/6-skills-every-php-freelancer-needs-pragmatic-testing-mysql-and-more/?utm_source=rss&amp;#038;utm_medium=rss&amp;#038;utm_campaign=6-skills-every-php-freelancer-needs-pragmatic-testing-mysql-and-more</pheedo:origLink>
			<comments>http://www.sitepoint.com/6-skills-every-php-freelancer-needs-pragmatic-testing-mysql-and-more/#comments</comments>
			<pubDate>Tue, 10 Apr 2012 09:09:06 +0000</pubDate>
			<dc:creator>Timothy Boronczyk</dc:creator>
			<category><![CDATA[PHP]]></category>
			<guid
isPermaLink="false">http://www.sitepoint.com/?p=53440</guid>
			<description><![CDATA[It's time to read all the great articles we've just published at PHPMaster, on topics as diverse as testing, software application services, and freelancing, as well as an explanation on how to pump up your SQL.<br clear="both" style="clear: both;"/>
<br clear="both" style="clear: both;"/>
<a href="http://ads.pheedo.com/click.phdo?s=8b3ff6a53881e7de0a8c9ad40683e304&p=1"><img alt="" style="border: 0;" border="0" src="http://ads.pheedo.com/img.phdo?s=8b3ff6a53881e7de0a8c9ad40683e304&p=1"/></a>
<img alt="" height="0" width="0" border="0" style="display:none" src="http://tags.bluekai.com/site/5148"/><img alt="" height="0" width="0" border="0" style="display:none" src="http://insight.adsrvr.org/track/evnt/?ct=0:8pyu3gz&adv=wouzn4v&fmt=3"/>]]></description>
			<content:encoded><![CDATA[<p></p><h2><a
href="http://phpmaster.com/thoughts-of-a-pragmatic-tester/">Thoughts of a Pragmatic Tester</a></h2><p>Some of us write unit tests, while others choose not to. Indeed, it’s important to test common usage, situations of improper usage, and rare events. But it’s also vital that you write your tests pragmatically, using functional (acceptance) tests for application’s behavior, and unit tests for internal APIs.</p><hr
/><h2><a
href="http://phpmaster.com/an-introduction-to-services/">An Introduction to Services</a></h2><p>Most software applications behave like whimsical babies with an unavoidable &#8220;tendency&#8221; to grow in size and complexity over time. You&#8217;re probably wondering how to tackle the problem without hitting your head against a brick wall. This article managing this, in particular, Services, because it plays nicely with Domain Models, and therefore with Domain-Driven Design.</p><hr
/><h2><a
href="http://phpmaster.com/using-explain-to-write-better-mysql-queries/">Using EXPLAIN to Write Better MySQL Queries</a></h2><p>The EXPLAIN keyword is one of the most powerful tools at your disposal for understanding and optimizing troublesome MySQL queries, but it&#8217;s a sad fact that many developers rarely make use of it. In this article, you&#8217;ll learn what the output of EXPLAIN can be and how to use it to optimize your schema and queries.<div
id='div-gpt-ad-1328644474660-10' style='width:728px; height:90px;'> <script type='text/javascript'>googletag.cmd.push(function() { googletag.display('div-gpt-ad-1328644474660-10'); });</script> </div></p><hr
/><h2><a
href="http://phpmaster.com/6-extra-skills-every-php-developer-should-have/">6 Skills Every PHP Freelancer Should Have</a></h2><p>PHP development is hot right now, but there’s also a lot of competition among developers. If you want to make it as an independent PHP developer, you&#8217;ve got to know more than just PHP. These six skills are essential for most freelancers, even more so for PHP developers.</p><hr
/><h2><a
href="http://phpmaster.com/bulletproofing-database-interactions/">Bulletproofing Database Interactions with PHPUnit&#8217;s Database Extension</a></h2><p>If your application is data-intensive, subjecting your CRUD code to a battery of tests is good practice that helps ensure that your application is working correctly. This article will help you get started using PHPUnit&#8217;s Database extension to automate tests for your code that interacts with your database.</p><hr
/> <span
id="pty_trigger"></span><div
style='padding:20px 0px 50px 0px;'><div
style='float:left;padding-left:40px;'><div
id='div-gpt-ad-1335489406190-0' style='width:300px; height:100px;'> <script type='text/javascript'>googletag.cmd.push(function() { googletag.display('div-gpt-ad-1335489406190-0'); });</script> </div></div><div
style='float:right;padding-right:40px;'><div
id='div-gpt-ad-1335489406190-1' style='width:300px; height:100px;'> <script type='text/javascript'>googletag.cmd.push(function() { googletag.display('div-gpt-ad-1335489406190-1'); });</script> </div></div><div
style='clear:both'></div></div><div
style='clear:both'></div><br clear="both" style="clear: both;"/>
<br clear="both" style="clear: both;"/>
<a href="http://ads.pheedo.com/click.phdo?s=8b3ff6a53881e7de0a8c9ad40683e304&p=1"><img alt="" style="border: 0;" border="0" src="http://ads.pheedo.com/img.phdo?s=8b3ff6a53881e7de0a8c9ad40683e304&p=1"/></a>
<img alt="" height="0" width="0" border="0" style="display:none" src="http://tags.bluekai.com/site/5148"/><img alt="" height="0" width="0" border="0" style="display:none" src="http://insight.adsrvr.org/track/evnt/?ct=0:8pyu3gz&adv=wouzn4v&fmt=3"/>]]></content:encoded>
			<wfw:commentRss>http://www.sitepoint.com/6-skills-every-php-freelancer-needs-pragmatic-testing-mysql-and-more/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		</item>
		<item>
			<title>Validating WordPress Comment Forms with jQuery and a Custom Plugin</title>
			<link>http://www.pheedcontent.com/click.phdo?i=0d3d0346d8b2266ffde10e94377f4203</link>
			<pheedo:origLink>http://www.sitepoint.com/validating-wordpress-comment-forms-with-jquery-and-a-custom-plugin/?utm_source=rss&amp;#038;utm_medium=rss&amp;#038;utm_campaign=validating-wordpress-comment-forms-with-jquery-and-a-custom-plugin</pheedo:origLink>
			<comments>http://www.sitepoint.com/validating-wordpress-comment-forms-with-jquery-and-a-custom-plugin/#comments</comments>
			<pubDate>Wed, 04 Apr 2012 21:18:20 +0000</pubDate>
			<dc:creator>Vladislav Davidzon</dc:creator>
			<category><![CDATA[jQuery]]></category>
			<category><![CDATA[PHP]]></category>
			<category><![CDATA[wordpress]]></category>
			<guid
isPermaLink="false">http://www.sitepoint.com/?p=53078</guid>
			<description><![CDATA[<img
width="50" height="50" src="http://www.sitepoint.com/wp-content/uploads/1/files/2009/09/wordpresslogo-150x150.png" class="attachment-thumbnail wp-post-image" alt="wordpresslogo.png" title="wordpresslogo.png" />In this tutorial Vladislav walks us through how to validate forms in WordPress by creating a simple plugin.<br clear="both" style="clear: both;"/>
<br clear="both" style="clear: both;"/>
<a href="http://ads.pheedo.com/click.phdo?s=0d3d0346d8b2266ffde10e94377f4203&p=1"><img alt="" style="border: 0;" border="0" src="http://ads.pheedo.com/img.phdo?s=0d3d0346d8b2266ffde10e94377f4203&p=1"/></a>
<img alt="" height="0" width="0" border="0" style="display:none" src="http://tags.bluekai.com/site/5148"/><img alt="" height="0" width="0" border="0" style="display:none" src="http://insight.adsrvr.org/track/evnt/?ct=0:8pyu3gz&adv=wouzn4v&fmt=3"/>]]></description>
			<content:encoded><![CDATA[<img
width="50" height="50" src="http://www.sitepoint.com/wp-content/uploads/1/files/2009/09/wordpresslogo-150x150.png" class="attachment-thumbnail wp-post-image" alt="wordpresslogo.png" title="wordpresslogo.png" /><p></p><p>One of the newest ways that web designers are increasing the usability and accessibility of their websites is by employing a combination of PHP, XHTML, and jQuery programming to validate forms &#8220;on the fly&#8221; as users fill them out. With WordPress, several pieces of information are almost always required in order to post a comment. A user must provide their name, their email address, and the comment itself. Some websites even require that users supply their website information when they post a comment. That&#8217;s a lot to remember, a lot to fill out, and the room for error is pretty big. A standard WordPress installation does not validate forms until a user has already clicked the submit button, meaning they don&#8217;t see any errors until the posting process has been completed. This leads to plenty of frustration and it simply isn&#8217;t usable in the modern era of blogging and interacting.</p><p>To replace this old-fashioned way of validating forms and replying with a user error, developers have begun employing jQuery to validate forms as users fill them out. Users will see a message displayed under each form as they proceed through the commenting process, and that message will either inform them that they&#8217;ve filled out the information successfully or it will alert them to an error and advise them to make a correction. This all happens before the &#8220;submit&#8221; button is clicked, and it saves users a page load and a few minutes of frustration in the process. It&#8217;s easy to do, and the library for form validation is already written. The only thing that&#8217;s holding most users back is developing the custom plugin to make this possible in WordPress, and that&#8217;s not nearly as taxing as most might think it is.<div
id='div-gpt-ad-1328644474660-10' style='width:728px; height:90px;'> <script type='text/javascript'>googletag.cmd.push(function() { googletag.display('div-gpt-ad-1328644474660-10'); });</script> </div></p><h2>Step 1: Create a Plugin Directory and Get the Files in Order</h2><p>The process used to validate a form requires that a custom plugin be generated within WordPress. This might intimidate some users, but rest assured that this plugin is just a more extensive series of additional &#8220;functions&#8221; like those that would typically be placed within a site-specific &#8220;functions.php&#8221; file. The validation function is added to a plugin so that it can be used across themes, rather than theme-specific functions files, which would require placing this code within every single one in order to make sure it works thoughout each user-installed theme in the Dashboard.</p><p>First and foremost, navigate to <code>/public_html/wp-content/plugins/</code> and create a new folder named &#8220;validation-plugin.&#8221; This will contain all of the relevant files and subfolders needed for proper operation. Open that folder and create two new subfolders for the plugin:</p><ul><li>js</li><li>css</li></ul><p>These folders are pretty self-explanatory. Inside the &#8220;js&#8221; folder, a jQuery library will be stored. Inside the &#8220;css&#8221; folder, a stylesheet will be placed, which will determine the appearance of the error or approval messages that are displayed to the commenting user.</p><p>The jQuery library needed for this process is known as the <a
href="http://bassistance.de/">Bassistance.de Library</a>. Once it has been downloaded, it should be placed into the &#8220;js&#8221; folder. Then create a new file called &#8220;validation.css&#8221; and place that (blank) stylesheet into the &#8220;css&#8221; folder. Finally, it&#8217;s time to create the plugin PHP file that will control the validation functions.</p><p>The PHP plugin file should be named &#8220;form-validation.php&#8221; and it should be placed outside the subfolders in the main plugin directory. This file can be left blank for now, as it will be edited directly on the server and filled with content and functions as the process continues.</p><h2>Step 2: Give the Plugin a Name and Describe its Functions</h2><p>Every WordPress plugin is required to contain a few lines of code which give it a name, a version, and some descriptive tags and blocks of text. This is much like the content placed in a &#8220;style.css&#8221; file, and it&#8217;s just as important. A plugin which lacks these lines of text won&#8217;t display in the WordPress Dashboard. That means it cannot be activated after completion, so be sure that each line of text is filled in completely with the proper information. These lines of text look like the following:</p><pre>
/**
* Plugin Name: Comment Form Validation Custom Plugin
* Plugin URI: http://your-site.com
* Description: This plugin enhances the WordPress comment form by using a jQuery library to validate the content of each text area and text box as the user types their information into them. This plugin can be used across themes and is compatible with all major browsers and even screen readers.
* Version: 1.0
* Author: Your Name (You're the Author!)
* Author URI: http://your-site-again.com
* License: GPL
*/
</pre><p>Each line in the above code is pretty self-explanatory. The only one which might throw some developers off is the &#8220;license&#8221; line. For novice users, this simply refers to the license under which the code is written and distributed. In this case, it has been defined as GPL, for GNU Public License. This pretty much means that anyone can use this code on their own website, or modify the code to their needs, so long as they give credit to the original author. Because WordPress is an open-source content management solution based on PHP, a GPL or GPL version 2.0 license is the most appropriate way to create, share, and minimally restrict your work.</p><h2>Step 3: Bringing the jQuery Library to Life Using Plugin Functions</h2><p>The next step of the process will add specific functions to the plugin&#8217;s PHP file, which will load the script and activate its functions on the comment submission website. This is done relatively simply and it looks exactly like something that would appear in a theme-specific &#8220;functions.php&#8221; file. Remember that this information and coding is based on using the appropriate plugin file directories, which were described in an earlier step of this process. The code, when completed, looks like this:</p><pre>
function form_validation_js() {
  if(is_single() ) {
    wp_enqueue_script(
      'jquery-validate',
      plugin_dir_url( __FILE__ ) . '/js/bassistance.js',
      array('jquery'),
      '1.8.1',
      true
    );
    form_validation_style(
      'jquery-validate',
      plugin_dir_url( __FILE__ ) . '/css/validation.css',
      array(),
     '1.0'
    );
  }
}
add_action('template_redirect', 'form_validation_script');
function print_validation_script() { ?>
< ?php } add_action('form_validation_script'); ? >
</pre><p>These can be customized to a user&#8217;s wishes and they can contain any punctuation or uppercase letters that a designer wants to include. Try to keep them brief and descriptive, however, as most people don&#8217;t read between the lines even when it&#8217;s well-styled using CSS code. The PHP programming part of this operation is now complete.</p><h2>Step 4: Styling Error Messages with Some CSS</h2><p>Now we&#8217;re going to use the stylesheet file that was created in the first step of this process. Navigate to the &#8220;css&#8221; folder and, in the &#8220;validation.css&#8221; file, add the following lines:</p><pre>
label.error {
  display: block;
  color: #000;
  background-color: yellow;
  padding: 10px;
}
</pre><p>Every error message is defined as a form label with the class &#8220;error.&#8221; This element simply styles these errors with black text, a yellow background, and design-friendly padding that keeps text from meeting the edge of the color. It can, of course, be customized according to your taste and your website&#8217;s design specifications.</p><p>Also worth noting is that this stylesheet information does not need to be placed into the plugin&#8217;s stylesheet at all. Because WordPress naturally draws its look and feel from the theme&#8217;s &#8220;style.css&#8221; file, it could be placed in that stylesheet instead. If your site uses multiple themes and switches them very often, or if you allow users to switch between your site&#8217;s installed WordPress themes, this is a great way to ensure that the comment form&#8217;s error messages blend in with each theme individually rather than inheriting a universal style from the plugin folder itself.</p><p>Be sure to test each form element and try to make it produce an error. Check out the styling, and the error message, and check for any bugs or glitches. If none exist, the process is complete and your website is now much more usable and accessible.</p> <span
id="pty_trigger"></span><div
style='padding:20px 0px 50px 0px;'><div
style='float:left;padding-left:40px;'><div
id='div-gpt-ad-1335489406190-0' style='width:300px; height:100px;'> <script type='text/javascript'>googletag.cmd.push(function() { googletag.display('div-gpt-ad-1335489406190-0'); });</script> </div></div><div
style='float:right;padding-right:40px;'><div
id='div-gpt-ad-1335489406190-1' style='width:300px; height:100px;'> <script type='text/javascript'>googletag.cmd.push(function() { googletag.display('div-gpt-ad-1335489406190-1'); });</script> </div></div><div
style='clear:both'></div></div><div
style='clear:both'></div><br clear="both" style="clear: both;"/>
<br clear="both" style="clear: both;"/>
<a href="http://ads.pheedo.com/click.phdo?s=0d3d0346d8b2266ffde10e94377f4203&p=1"><img alt="" style="border: 0;" border="0" src="http://ads.pheedo.com/img.phdo?s=0d3d0346d8b2266ffde10e94377f4203&p=1"/></a>
<img alt="" height="0" width="0" border="0" style="display:none" src="http://tags.bluekai.com/site/5148"/><img alt="" height="0" width="0" border="0" style="display:none" src="http://insight.adsrvr.org/track/evnt/?ct=0:8pyu3gz&adv=wouzn4v&fmt=3"/>]]></content:encoded>
			<wfw:commentRss>http://www.sitepoint.com/validating-wordpress-comment-forms-with-jquery-and-a-custom-plugin/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		</item>
		<item>
			<title>PHPMaster: Role Based Access Control, pChart, CI with Jenkins, and More</title>
			<link>http://www.pheedcontent.com/click.phdo?i=8f0e14793e065fd3508f5f354a09a949</link>
			<pheedo:origLink>http://www.sitepoint.com/phpmaster-role-based-access-control-pchart-ci-with-jenkins-and-more/?utm_source=rss&amp;#038;utm_medium=rss&amp;#038;utm_campaign=phpmaster-role-based-access-control-pchart-ci-with-jenkins-and-more</pheedo:origLink>
			<comments>http://www.sitepoint.com/phpmaster-role-based-access-control-pchart-ci-with-jenkins-and-more/#comments</comments>
			<pubDate>Tue, 27 Mar 2012 18:00:08 +0000</pubDate>
			<dc:creator>Timothy Boronczyk</dc:creator>
			<category><![CDATA[PHP]]></category>
			<guid
isPermaLink="false">http://www.sitepoint.com/?p=53021</guid>
			<description><![CDATA[Over at PHPMaster, we're looking into Role Based Access Control, using pChart with Google Analytics, integrating data mappers into a domain model, error logging with MongoDB and Analog, and more.<br clear="both" style="clear: both;"/>
<br clear="both" style="clear: both;"/>
<a href="http://ads.pheedo.com/click.phdo?s=8f0e14793e065fd3508f5f354a09a949&p=1"><img alt="" style="border: 0;" border="0" src="http://ads.pheedo.com/img.phdo?s=8f0e14793e065fd3508f5f354a09a949&p=1"/></a>
<img alt="" height="0" width="0" border="0" style="display:none" src="http://tags.bluekai.com/site/5148"/><img alt="" height="0" width="0" border="0" style="display:none" src="http://insight.adsrvr.org/track/evnt/?ct=0:8pyu3gz&adv=wouzn4v&fmt=3"/>]]></description>
			<content:encoded><![CDATA[<p></p><h2><a
href="http://phpmaster.com/role-based-access-control-in-php/">Role Based Access Control in PHP</a></h2><p>Role Based Access Control is a model in which roles are created for various job functions and permissions to perform operations that are then tied to them. Users can be assigned one or multiple roles, which restrict their system access to the permissions they&#8217;ve been authorized for. In this article, you&#8217;ll learn more about RBAC and how to enhance your existing authentication system with it.</p><hr
/><h2><a
href="http://phpmaster.com/pchart-revisited-with-google-analytics/">pChart Revisited with Google Analytics</a></h2><p>Back in December, PHPMaster published an introductory article written by J Armando Jeronymo on pChart, a PHP library that creates eye-catching anti-aliased charts. A reader asked for more articles with further examples, so he has written this follow-up. It features a handy device for visually checking website statistics using Google Analytics&#8217; GAPI.</p><hr
/><h2><a
href="http://phpmaster.com/integrating-the-data-mappers/">Building a Domain Model: Integrating Data Mappers</a></h2><p>You&#8217;ve seen how to write data models, now learn how to put them to work in synchrony with a &#8220;real&#8221; persistence layer. In this follow-up to Alejandro&#8217;s article on persistence agnosticism, you&#8217;ll develop a basic mapping module which will allow you to move data easily between a model and a MySQL database, all while keeping them neatly isolated from each other.<div
id='div-gpt-ad-1328644474660-10' style='width:728px; height:90px;'> <script type='text/javascript'>googletag.cmd.push(function() { googletag.display('div-gpt-ad-1328644474660-10'); });</script> </div></p><hr
/><h2><a
href="http://phpmaster.com/error-logging-with-mongodb-and-analog/">Error Logging with MongoDB and Analog</a></h2><p>With the hype around document databases continuing to grow, and around MongoDB in particular, there are a lot of questions about how to migrate your applications to begin using it. The advice is usually the same – especially for existing applications: take one step at a time. This article will show how you can add logging to your existing code using MongDB and Analog.</p><hr
/><h2><a
href="http://phpmaster.com/continuous-integration-with-jenkins-1/">Continuous Integration with Jenkins, Part 1</a></h2><p>Continuous integration is a software quality-control technique that checks code integrity whenever small changes are made, rather than waiting for all the code to be finished before testing and debugging. This is the first in a two-part series that introduces Jenkins. It presents a big-picture overview of the sort of programming problems CI can solve.</p><hr
/> <span
id="pty_trigger"></span><div
style='padding:20px 0px 50px 0px;'><div
style='float:left;padding-left:40px;'><div
id='div-gpt-ad-1335489406190-0' style='width:300px; height:100px;'> <script type='text/javascript'>googletag.cmd.push(function() { googletag.display('div-gpt-ad-1335489406190-0'); });</script> </div></div><div
style='float:right;padding-right:40px;'><div
id='div-gpt-ad-1335489406190-1' style='width:300px; height:100px;'> <script type='text/javascript'>googletag.cmd.push(function() { googletag.display('div-gpt-ad-1335489406190-1'); });</script> </div></div><div
style='clear:both'></div></div><div
style='clear:both'></div><br clear="both" style="clear: both;"/>
<br clear="both" style="clear: both;"/>
<a href="http://ads.pheedo.com/click.phdo?s=8f0e14793e065fd3508f5f354a09a949&p=1"><img alt="" style="border: 0;" border="0" src="http://ads.pheedo.com/img.phdo?s=8f0e14793e065fd3508f5f354a09a949&p=1"/></a>
<img alt="" height="0" width="0" border="0" style="display:none" src="http://tags.bluekai.com/site/5148"/><img alt="" height="0" width="0" border="0" style="display:none" src="http://insight.adsrvr.org/track/evnt/?ct=0:8pyu3gz&adv=wouzn4v&fmt=3"/>]]></content:encoded>
			<wfw:commentRss>http://www.sitepoint.com/phpmaster-role-based-access-control-pchart-ci-with-jenkins-and-more/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		</item>
		<item>
			<title>PHP 5.4 is Released &#8212; What&#8217;s New?</title>
			<link>http://www.pheedcontent.com/click.phdo?i=0a4e79c22ce44e1b719073b1c0ce4254</link>
			<pheedo:origLink>http://www.sitepoint.com/whats-new-in-php-54/?utm_source=rss&amp;#038;utm_medium=rss&amp;#038;utm_campaign=whats-new-in-php-54</pheedo:origLink>
			<comments>http://www.sitepoint.com/whats-new-in-php-54/#comments</comments>
			<pubDate>Mon, 05 Mar 2012 17:14:23 +0000</pubDate>
			<dc:creator>Craig Buckler</dc:creator>
			<category><![CDATA[PHP]]></category>
			<category><![CDATA[PHP & MySQL News & Interviews]]></category>
			<category><![CDATA[PHP & MySQL Tutorials]]></category>
			<category><![CDATA[php 5.4]]></category>
			<guid
isPermaLink="false">http://www.sitepoint.com/?p=52336</guid>
			<description><![CDATA[<img
width="50" height="26" src="http://www.sitepoint.com/wp-content/uploads/1/files/2008/06/phpframework1.jpeg" class="attachment-thumbnail wp-post-image" alt="Powered by the PHP framework" title="Powered by the PHP framework" />PHP 5.4 has finally been released. Craig looks at the what's new, improved and removed.<br clear="both" style="clear: both;"/>
<br clear="both" style="clear: both;"/>
<a href="http://ads.pheedo.com/click.phdo?s=0a4e79c22ce44e1b719073b1c0ce4254&p=1"><img alt="" style="border: 0;" border="0" src="http://ads.pheedo.com/img.phdo?s=0a4e79c22ce44e1b719073b1c0ce4254&p=1"/></a>
<img alt="" height="0" width="0" border="0" style="display:none" src="http://tags.bluekai.com/site/5148"/><img alt="" height="0" width="0" border="0" style="display:none" src="http://insight.adsrvr.org/track/evnt/?ct=0:8pyu3gz&adv=wouzn4v&fmt=3"/>]]></description>
			<content:encoded><![CDATA[<img
width="50" height="26" src="http://www.sitepoint.com/wp-content/uploads/1/files/2008/06/phpframework1.jpeg" class="attachment-thumbnail wp-post-image" alt="Powered by the PHP framework" title="Powered by the PHP framework" /><p></p><p>It&#8217;s difficult to believe almost three years have elapsed since PHP 5.3.0. The next version should have been PHP 6.0 but unicode problems have delayed development. This latest version provides many of the features planned for version 6.0.</p><p><a
href="http://docs.php.net/downloads.php"><strong>PHP 5.4 is available to download from the php.net website</strong></a>. There&#8217;s a <a
href="http://uk.php.net/migration54">PHP 5.3 migration guide</a> if you want to keep your old settings. While it&#8217;s stable, you&#8217;d be advised to test your sites and applications before installing it on live servers. The PHP team often release a bug-fix version a few weeks after the initial release.</p><p>So let&#8217;s look at the best new features and improvements&hellip;</p><h2>Short Array Syntax</h2><p>It&#8217;s now possible to use finger-saving JavaScript-like square brackets rather than using the old <code>array(&hellip;)</code> construct, e.g.</p><pre><code>
$array1 = [1, 2, 3];
$array2 = [
	&quot;one&quot; =&gt; &quot;first&quot;,
	&quot;two&quot; =&gt; &quot;second&quot;,
	&quot;three&quot; =&gt; &quot;third&quot;
];
</code></pre><h2>Traits</h2><p>Traits reduce some limitations of single inheritance. In essence, traits are similar to abstract classes and can contain any number of properties and methods. A class can then <code>use</code> any number of traits, e.g.<div
id='div-gpt-ad-1328644474660-10' style='width:728px; height:90px;'> <script type='text/javascript'>googletag.cmd.push(function() { googletag.display('div-gpt-ad-1328644474660-10'); });</script> </div></p><pre><code>
trait Hello
{
    function sayHello() {
        return &quot;Hello&quot;;
    }
}
trait World
{
    function sayWorld() {
        return &quot;World&quot;;
    }
}
class MyWorld
{
    use Hello, World;
}
$world = new MyWorld();
echo $world-&gt;sayHello() . ' ' . $world-&gt;sayWorld();
</code></pre><p>For more information, refer to <a
href="http://phpmaster.com/using-traits-in-php-5-4/">Using Traits in PHP 5.4 on PHPmaster.com</a>.</p><h2>Built-in Web Server</h2><p>PHP 5.4 offers a built-in web server which runs from the Windows, Mac or Linux command line. While it&#8217;s not Apache or IIS, it&#8217;s fine for simple testing. I suspect many of the better PHP IDEs will implement support shortly.</p><p>For more information, refer to <a
href="http://www.sitepoint.com/php-54-web-server/">PHP 5.4&#8242;s New Built-in Web Server</a>.</p><h2>New Commands</h2><p>A number of useful commands have been implemented:</p><ol><li><a
href="http://uk.php.net/manual/en/function.hex2bin.php">hextobin(string $hex)</a>: coverts a hex representation of data to binary.</li><li><a
href="http://uk.php.net/manual/en/function.http-response-code.php">http_response_code(int $code)</a>: allows you to set or get the HTTP response code, e.g. <code>http_response_code(404);</code></li><li><a
href="http://uk.php.net/manual/en/function.header-register-callback.php">header_register_callback(string $function)</a>: allows you to register a function which is called when PHP starts sending output.</li><li><a
href="http://uk.php.net/manual/en/function.trait-exists.php">trait_exists(string $name [,bool $autoload])</a>: determines whether a trait exists and, optionally, whether it should be autoloaded.</li></ol><h2>Miscellaneous Updates</h2><p>If that&#8217;s not enough&hellip;</p><ul><li>Class members can be accessed on instantiation, e.g. <code>(new MyClass)-&gt;MyMethod()</code></li><li><code>&lt;?=$variable?&gt;</code> is always available regardless of how your short_open_tag ini option is set.</li><li>Binary numbers can be declared, e.g. <code>0b11110000</code></li><li><a
href="http://docs.php.net/manual/en/session.upload-progress.php">Session upload progress</a> has been implemented so PHP can track the state of file uploads.</li><li>Some users are reporting speed increases of up to 25% with a memory reduction of 35%.</li></ul><h2>Compatibility Issues</h2><p>Most older PHP code <em>should</em> run without modification but there are a few gotchas to look out for:</p><ul><li><a
href="http://uk.php.net/manual/en/features.safe-mode.php">Safe mode</a>, <a
href="http://uk.php.net/manual/en/ini.core.php#ini.register-globals">register_globals</a> and <a
href="http://uk.php.net/manual/en/security.magicquotes.php">magic quotes</a> have been removed. <a
href="http://uk.php.net/manual/en/function.get-magic-quotes-gpc.php">get_magic_quotes_gpc()</a> will always return FALSE.</li><li><a
href="http://uk.php.net/manual/en/language.oop5.traits.php">trait</a>, callable and <a
href="http://uk.php.net/manual/en/language.oop5.traits.php">insteadof</a> have become reserved words.</li><li>Several mysqli aliases have been removed.</li></ul><p>You should also note that PHP 5.4.x will be the last edition to support Windows XP and Windows 2003.</p><p>PHP 5.4 isn&#8217;t quite as radical has 5.3, but there are enough new features to keep developers happy for a while. Let us know if you have any positive or negative experiences with the latest version.</p> <span
id="pty_trigger"></span><div
style='padding:20px 0px 50px 0px;'><div
style='float:left;padding-left:40px;'><div
id='div-gpt-ad-1335489406190-0' style='width:300px; height:100px;'> <script type='text/javascript'>googletag.cmd.push(function() { googletag.display('div-gpt-ad-1335489406190-0'); });</script> </div></div><div
style='float:right;padding-right:40px;'><div
id='div-gpt-ad-1335489406190-1' style='width:300px; height:100px;'> <script type='text/javascript'>googletag.cmd.push(function() { googletag.display('div-gpt-ad-1335489406190-1'); });</script> </div></div><div
style='clear:both'></div></div><div
style='clear:both'></div><br clear="both" style="clear: both;"/>
<br clear="both" style="clear: both;"/>
<a href="http://ads.pheedo.com/click.phdo?s=0a4e79c22ce44e1b719073b1c0ce4254&p=1"><img alt="" style="border: 0;" border="0" src="http://ads.pheedo.com/img.phdo?s=0a4e79c22ce44e1b719073b1c0ce4254&p=1"/></a>
<img alt="" height="0" width="0" border="0" style="display:none" src="http://tags.bluekai.com/site/5148"/><img alt="" height="0" width="0" border="0" style="display:none" src="http://insight.adsrvr.org/track/evnt/?ct=0:8pyu3gz&adv=wouzn4v&fmt=3"/>]]></content:encoded>
			<wfw:commentRss>http://www.sitepoint.com/whats-new-in-php-54/feed/</wfw:commentRss>
			<slash:comments>26</slash:comments>
		</item>
		<div>
			<div
class="post_box two_ads" style="float:left;padding-left:2px;">
				<div
id='div-gpt-ad-1328645237920-1' style='width:728px; height:90px;'>
					<script type='text/javascript'>googletag.cmd.push(function() { googletag.display('div-gpt-ad-1328645237920-1'); });</script>
				</div>
			</div>
		</div>
		<div
class="clear">&nbsp;</div>
		<item>
			<title>WordPress Plugin Development, PHP and SOAP, Building a Domain Model, and More</title>
			<link>http://www.pheedcontent.com/click.phdo?i=66b41520aadf478f6be0adf04fe90e0c</link>
			<pheedo:origLink>http://www.sitepoint.com/wordpress-plugin-development-php-and-soap-building-a-domain-model-and-more/?utm_source=rss&amp;#038;utm_medium=rss&amp;#038;utm_campaign=wordpress-plugin-development-php-and-soap-building-a-domain-model-and-more</pheedo:origLink>
			<comments>http://www.sitepoint.com/wordpress-plugin-development-php-and-soap-building-a-domain-model-and-more/#comments</comments>
			<pubDate>Fri, 02 Mar 2012 11:20:54 +0000</pubDate>
			<dc:creator>Timothy Boronczyk</dc:creator>
			<category><![CDATA[PHP]]></category>
			<category><![CDATA[PHP & MySQL Tutorials]]></category>
			<category><![CDATA[phpmaster]]></category>
			<guid
isPermaLink="false">http://www.sitepoint.com/?p=51954</guid>
			<description><![CDATA[<img
width="50" height="15" src="http://www.sitepoint.com/wp-content/uploads/1/files/2012/03/phpmaster-50x15.png" class="attachment-thumbnail wp-post-image" alt="phpmaster" title="phpmaster" />Are you up to speed with Phar, WordPress plugin debelopment, building web services using PHP and SOAP, the Observer Pattern, and persistence agnosticism?<br clear="both" style="clear: both;"/>
<br clear="both" style="clear: both;"/>
<a href="http://ads.pheedo.com/click.phdo?s=66b41520aadf478f6be0adf04fe90e0c&p=1"><img alt="" style="border: 0;" border="0" src="http://ads.pheedo.com/img.phdo?s=66b41520aadf478f6be0adf04fe90e0c&p=1"/></a>
<img alt="" height="0" width="0" border="0" style="display:none" src="http://tags.bluekai.com/site/5148"/><img alt="" height="0" width="0" border="0" style="display:none" src="http://insight.adsrvr.org/track/evnt/?ct=0:8pyu3gz&adv=wouzn4v&fmt=3"/>]]></description>
			<content:encoded><![CDATA[<img
width="50" height="15" src="http://www.sitepoint.com/wp-content/uploads/1/files/2012/03/phpmaster-50x15.png" class="attachment-thumbnail wp-post-image" alt="phpmaster" title="phpmaster" /><p></p><h2><a
href="http://phpmaster.com/packaging-your-apps-with-phar/">Packaging Your Apps with Phar</a></h2><p>Deployment of web applications can be difficult and cumbersome without the right tools. This article will introduce you to PHAR, PHP&#8217;s package format which can help you have a better deployment experience.</p><hr
/><h2><a
href="http://phpmaster.com/wordpress-plugin-development/">WordPress Plugin Development</a></h2><p>If you&#8217;ve ever used WordPress to build a site quickly, chances are you&#8217;ve used one of the many plugins that are offered to extend the functionality of this popular blogging software. There are times, however, when you can struggle to find what you need from existing plugins. This article shows you how to create your own WordPress plugins.</p><hr
/><h2><a
href="http://phpmaster.com/web-services-with-php-and-soap-1/">Creating Web Services with PHP and SOAP, Part 1</a></h2><p>The ability to develop software and services for a wide range of platforms is a necessary skill for programmers, and SOAP, an XML-based protocol, will help ease the burden. Learn about SOAP and make your own SOAP client and server using the NuSOAP library in the first of this two-part series.</p><hr
/><h2><a
href="http://phpmaster.com/understanding-the-observer-pattern/">Understanding the Observer Pattern</a></h2><p>In this article, you&#8217;ll learn how to implement the Observer Pattern, a behavioral design pattern that defines a one-to-many relationship between objects. Therefore, when one object changes its state, all dependent objects are notified and updated automatically.<div
id='div-gpt-ad-1328644474660-10' style='width:728px; height:90px;'> <script type='text/javascript'>googletag.cmd.push(function() { googletag.display('div-gpt-ad-1328644474660-10'); });</script> </div></p><hr
/><h2><a
href="http://phpmaster.com/building-a-domain-model/">Building a Domain Model: An Introduction to Persistence Agnosticism</a></h2><p>With tons of MVC-based frameworks proliferating like hungry ants, the &#8220;model&#8221; part continues to suffer from the symptoms of an ad hoc Database Model layer. This article will teach you another way, one that will help you focus more on keeping access code out of your domain logic, as well as maintain a clear boundary of responsibility.</p><hr
/> <span
id="pty_trigger"></span><div
style='padding:20px 0px 50px 0px;'><div
style='float:left;padding-left:40px;'><div
id='div-gpt-ad-1335489406190-0' style='width:300px; height:100px;'> <script type='text/javascript'>googletag.cmd.push(function() { googletag.display('div-gpt-ad-1335489406190-0'); });</script> </div></div><div
style='float:right;padding-right:40px;'><div
id='div-gpt-ad-1335489406190-1' style='width:300px; height:100px;'> <script type='text/javascript'>googletag.cmd.push(function() { googletag.display('div-gpt-ad-1335489406190-1'); });</script> </div></div><div
style='clear:both'></div></div><div
style='clear:both'></div><br clear="both" style="clear: both;"/>
<br clear="both" style="clear: both;"/>
<a href="http://ads.pheedo.com/click.phdo?s=66b41520aadf478f6be0adf04fe90e0c&p=1"><img alt="" style="border: 0;" border="0" src="http://ads.pheedo.com/img.phdo?s=66b41520aadf478f6be0adf04fe90e0c&p=1"/></a>
<img alt="" height="0" width="0" border="0" style="display:none" src="http://tags.bluekai.com/site/5148"/><img alt="" height="0" width="0" border="0" style="display:none" src="http://insight.adsrvr.org/track/evnt/?ct=0:8pyu3gz&adv=wouzn4v&fmt=3"/>]]></content:encoded>
			<wfw:commentRss>http://www.sitepoint.com/wordpress-plugin-development-php-and-soap-building-a-domain-model-and-more/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		</item>
		<item>
			<title>Is Your PHP Behind the Curve?</title>
			<link>http://www.pheedcontent.com/click.phdo?i=5d0464ca5166ad15185a96deda1a90f6</link>
			<pheedo:origLink>http://www.sitepoint.com/is-your-php-behind-the-curve/?utm_source=rss&amp;#038;utm_medium=rss&amp;#038;utm_campaign=is-your-php-behind-the-curve</pheedo:origLink>
			<comments>http://www.sitepoint.com/is-your-php-behind-the-curve/#comments</comments>
			<pubDate>Wed, 15 Feb 2012 05:56:54 +0000</pubDate>
			<dc:creator>Timothy Boronczyk</dc:creator>
			<category><![CDATA[PHP]]></category>
			<guid
isPermaLink="false">http://www.sitepoint.com/?p=51498</guid>
			<description><![CDATA[<img
width="50" height="21" src="http://www.sitepoint.com/wp-content/uploads/1/files/2012/01/phpmaster.-50x21.png" class="attachment-thumbnail wp-post-image" alt="phpmaster." title="phpmaster." />Stay ahead of the crowd by checking out the latest and greatest in the world of PHP<br clear="both" style="clear: both;"/>
<br clear="both" style="clear: both;"/>
<a href="http://ads.pheedo.com/click.phdo?s=5d0464ca5166ad15185a96deda1a90f6&p=1"><img alt="" style="border: 0;" border="0" src="http://ads.pheedo.com/img.phdo?s=5d0464ca5166ad15185a96deda1a90f6&p=1"/></a>
<img alt="" height="0" width="0" border="0" style="display:none" src="http://tags.bluekai.com/site/5148"/><img alt="" height="0" width="0" border="0" style="display:none" src="http://insight.adsrvr.org/track/evnt/?ct=0:8pyu3gz&adv=wouzn4v&fmt=3"/>]]></description>
			<content:encoded><![CDATA[<img
width="50" height="21" src="http://www.sitepoint.com/wp-content/uploads/1/files/2012/01/phpmaster.-50x21.png" class="attachment-thumbnail wp-post-image" alt="phpmaster." title="phpmaster." /><p></p><h2><a
href="http://phpmaster.com/using-traits-in-php-5-4/">Using Traits in PHP 5.4</a></h2><p>Less code duplication, more code reuse is a goal of OOP, but sometimes it can be difficult with PHP’s single inheritance model. Traits offer a workaround to horizontally reuse code across different class hierarchies. They’re new in PHP 5.4 so learn about them today!</p><hr
/><h2><a
href="http://phpmaster.com/tracking-upload-progress-with-php-and-javascript/">Tracking Upload Progress with PHP and JavaScript</a></h2><p>A problem that has plagued web developers for years is how to add real-time information to their applications, such as a progress bar for file uploads. Learn how a new feature in PHP 5.4 can be used to create a dynamic upload progress bar without any external libraries or browser dependencies.</p><hr
/><h2><a
href="http://phpmaster.com/where-on-earth-are-you/">Where on Earth are you?</a></h2><p>Modern geolocation applications use latitude and longitude to identify the location of people and places to within a few meters – but it’s highly unlikely you’ll answer the question &#8220;Where on Earth are you?&#8221;. Learn how to use the Yahoo! Placemaker server and write a simple program to ask users where they are before identifying their location in concrete terms.<div
id='div-gpt-ad-1328644474660-10' style='width:728px; height:90px;'> <script type='text/javascript'>googletag.cmd.push(function() { googletag.display('div-gpt-ad-1328644474660-10'); });</script> </div></p><hr
/><h2><a
href="http://phpmaster.com/autoloading-and-the-psr-0-standard/">Autoloading in PHP and the PSR-0 Standard</a></h2><p>Including a slew of extra files at the top of your scripts can be a drag! Learn about the “history of autoloading” and the current PSR-0 standard used in many PHP frameworks such as Lithium, Symfony, and Zend, that makes lengthy include lists a thing of the past.</p><hr
/><h2><a
href="http://phpmaster.com/yii-under-the-hood-2/">Under the Hood of Yii’s Component Architecture Part 2</a></h2><p>This is Part 2 of the 3-part series that shows you some of the inner-workings of the Yii Framework&#8217;s component architecture. In this installment you&#8217;ll learn how you can do event-based programming in PHP and how Yii&#8217;s CComponent class helps facilitate it.</p><hr
/> <span
id="pty_trigger"></span><div
style='padding:20px 0px 50px 0px;'><div
style='float:left;padding-left:40px;'><div
id='div-gpt-ad-1335489406190-0' style='width:300px; height:100px;'> <script type='text/javascript'>googletag.cmd.push(function() { googletag.display('div-gpt-ad-1335489406190-0'); });</script> </div></div><div
style='float:right;padding-right:40px;'><div
id='div-gpt-ad-1335489406190-1' style='width:300px; height:100px;'> <script type='text/javascript'>googletag.cmd.push(function() { googletag.display('div-gpt-ad-1335489406190-1'); });</script> </div></div><div
style='clear:both'></div></div><div
style='clear:both'></div><br clear="both" style="clear: both;"/>
<br clear="both" style="clear: both;"/>
<a href="http://ads.pheedo.com/click.phdo?s=5d0464ca5166ad15185a96deda1a90f6&p=1"><img alt="" style="border: 0;" border="0" src="http://ads.pheedo.com/img.phdo?s=5d0464ca5166ad15185a96deda1a90f6&p=1"/></a>
<img alt="" height="0" width="0" border="0" style="display:none" src="http://tags.bluekai.com/site/5148"/><img alt="" height="0" width="0" border="0" style="display:none" src="http://insight.adsrvr.org/track/evnt/?ct=0:8pyu3gz&adv=wouzn4v&fmt=3"/>]]></content:encoded>
			<wfw:commentRss>http://www.sitepoint.com/is-your-php-behind-the-curve/feed/</wfw:commentRss>
			<slash:comments>3</slash:comments>
		</item>
		<item>
			<title>How to Create Your Own Random Number Generator in PHP</title>
			<link>http://www.pheedcontent.com/click.phdo?i=1f71aff82f0541471e9ddfd205c563f9</link>
			<pheedo:origLink>http://www.sitepoint.com/php-random-number-generator/?utm_source=rss&amp;#038;utm_medium=rss&amp;#038;utm_campaign=php-random-number-generator</pheedo:origLink>
			<comments>http://www.sitepoint.com/php-random-number-generator/#comments</comments>
			<pubDate>Wed, 08 Feb 2012 15:50:17 +0000</pubDate>
			<dc:creator>Craig Buckler</dc:creator>
			<category><![CDATA[PHP]]></category>
			<category><![CDATA[PHP & MySQL Tutorials]]></category>
			<category><![CDATA[Technology]]></category>
			<category><![CDATA[random]]></category>
			<guid
isPermaLink="false">http://www.sitepoint.com/?p=50865</guid>
			<description><![CDATA[<img
width="50" height="50" src="http://www.sitepoint.com/wp-content/uploads/1/files/2012/01/631-psuedo-random-php-50x50.png" class="attachment-thumbnail wp-post-image" alt="631-psuedo-random-php" title="631-psuedo-random-php" />Craig explains how you can write your own random number generator in PHP - and why you'd want to do that given that PHP has its own random generation functions.<br clear="both" style="clear: both;"/>
<br clear="both" style="clear: both;"/>
<a href="http://ads.pheedo.com/click.phdo?s=1f71aff82f0541471e9ddfd205c563f9&p=1"><img alt="" style="border: 0;" border="0" src="http://ads.pheedo.com/img.phdo?s=1f71aff82f0541471e9ddfd205c563f9&p=1"/></a>
<img alt="" height="0" width="0" border="0" style="display:none" src="http://tags.bluekai.com/site/5148"/><img alt="" height="0" width="0" border="0" style="display:none" src="http://insight.adsrvr.org/track/evnt/?ct=0:8pyu3gz&adv=wouzn4v&fmt=3"/>]]></description>
			<content:encoded><![CDATA[<img
width="50" height="50" src="http://www.sitepoint.com/wp-content/uploads/1/files/2012/01/631-psuedo-random-php-50x50.png" class="attachment-thumbnail wp-post-image" alt="631-psuedo-random-php" title="631-psuedo-random-php" /><p></p><p>Computers cannot generate random numbers. A machine which works in ones and zeros is unable to magically invent its own stream of random data. However, computers can implement mathematical algorithms which produce pseudo-random numbers. They look like random numbers. They feel like random distributions. But they&#8217;re fake; the same sequence of digits is generated if you run the algorithm twice.</p><h2>Planting Random Seeds</h2><p>To increase the apparent randomness, most algorithms can be passed a seed &#8212; an initialization number for the random sequence. Passing the same seed twice will still generate the same set of random numbers but you can set the seed based on external input factors. The easiest option is the current time but it can be anything; the last keypress, a mouse movement, the temperature, the number of hours wasted on YouTube, or any other factor.</p><h2>Random PHP Functions</h2><p>PHP offers a number of random number functions. The main ones are:</p><ol><li><p><a
href="http://php.net/manual/en/function.rand.php">rand()</a> and the more efficient <a
href="http://www.php.net/manual/en/function.mt-rand.php">mt_rand()</a> function. Both return a random number between zero and <a
href="http://www.php.net/manual/en/function.getrandmax.php">getrandmax()</a>/<a
href="http://www.php.net/manual/en/function.mt-getrandmax.php">mt_getrandmax()</a>. Alternatively, you can pass minimum and maximum parameters:<div
id='div-gpt-ad-1328644474660-10' style='width:728px; height:90px;'> <script type='text/javascript'>googletag.cmd.push(function() { googletag.display('div-gpt-ad-1328644474660-10'); });</script> </div></p><pre><code>
// random number between 0 and 10 (inclusive)
echo mt_rand(0, 10);
</code></pre></li><li><p><a
href="http://www.php.net/manual/en/function.srand.php">srand($seed)</a> and <a
href="http://www.php.net/manual/en/function.mt-srand.php">mt_srand($seed)</a> to set a random number seed. This has been done automatically since PHP 4.2.0.</p></li></ol><h2>PHP is Too Random!</h2><p>There are instances when creating a repeatable list of pseudo-random numbers is useful. It&#8217;s often used for security or verification purposes, e.g. encrypting a password before it&#8217;s transmitted or generating a hash code for a set of data. Unfortunately, PHP can be a little <em>too</em> random. A generated sequence will depend on your hosting platform and version of PHP. In other words, you can&#8217;t guarantee the same &#8216;random&#8217; sequence will be generated twice on two different machines even if the same seed is used.</p><h2>Rolling Your Own Random Class</h2><p>Fortunately, we can write our own random number generator. You&#8217;ll find many algorithms on the web, but this is one of the shortest and fastest. First, we initialize our class and a random seed variable:</p><pre><code>
class Random {
	// random seed
	private static $RSeed = 0;
</code></pre><p>Next we have a seed() function for setting a new seed value. For the algorithm to work correctly, the seed should always be a positive number greater than zero but not large enough to cause mathematical overflows. The seed function takes any value but converts it to a number between 1 and 9,999,999:</p><pre><code>
	// set seed
	public static function seed($s = 0) {
		self::$RSeed = abs(intval($s)) % 9999999 + 1;
		self::num();
	}
</code></pre><p>Finally, we have our num() function for generating a random number between $min and $max. If no seed has been set it&#8217;s initialized with PHP&#8217;s own random number generator:</p><pre><code>
	// generate random number
	public static function num($min = 0, $max = 9999999) {
		if (self::$RSeed == 0) self::seed(mt_rand());
		self::$RSeed = (self::$RSeed * 125) % 2796203;
		return self::$RSeed % ($max - $min + 1) + $min;
	}
}
</code></pre><p>We can now set a seed and output a sequence of numbers:</p><pre><code>
// set seed
Random::seed(42);
// echo 10 numbers between 1 and 100
for ($i = 0; $i &lt; 10; $i++) {
	echo Random::num(1, 100) . '&lt;br /&gt;';
}
</code></pre><p>If you&#8217;ve copied this code exactly, you should see the following values no matter what OS or version of PHP you&#8217;re running:</p><pre>
76
86
14
79
73
2
87
43
62
7
</pre><p>Admittedly, repeatable <em>&#8220;random&#8221;</em> numbers isn&#8217;t something you&#8217;ll need every day &#8212; you&#8217;re more likely to require something closer to real randomness and PHP&#8217;s functions will serve you better. But there may be occasions when you find this useful.</p> <span
id="pty_trigger"></span><div
style='padding:20px 0px 50px 0px;'><div
style='float:left;padding-left:40px;'><div
id='div-gpt-ad-1335489406190-0' style='width:300px; height:100px;'> <script type='text/javascript'>googletag.cmd.push(function() { googletag.display('div-gpt-ad-1335489406190-0'); });</script> </div></div><div
style='float:right;padding-right:40px;'><div
id='div-gpt-ad-1335489406190-1' style='width:300px; height:100px;'> <script type='text/javascript'>googletag.cmd.push(function() { googletag.display('div-gpt-ad-1335489406190-1'); });</script> </div></div><div
style='clear:both'></div></div><div
style='clear:both'></div><br clear="both" style="clear: both;"/>
<br clear="both" style="clear: both;"/>
<a href="http://ads.pheedo.com/click.phdo?s=1f71aff82f0541471e9ddfd205c563f9&p=1"><img alt="" style="border: 0;" border="0" src="http://ads.pheedo.com/img.phdo?s=1f71aff82f0541471e9ddfd205c563f9&p=1"/></a>
<img alt="" height="0" width="0" border="0" style="display:none" src="http://tags.bluekai.com/site/5148"/><img alt="" height="0" width="0" border="0" style="display:none" src="http://insight.adsrvr.org/track/evnt/?ct=0:8pyu3gz&adv=wouzn4v&fmt=3"/>]]></content:encoded>
			<wfw:commentRss>http://www.sitepoint.com/php-random-number-generator/feed/</wfw:commentRss>
			<slash:comments>10</slash:comments>
		</item>
		<item>
			<title>PHPMaster: How I Chose My Programming Editor</title>
			<link>http://www.pheedcontent.com/click.phdo?i=d2742c1f2b255b001d79b0adffcaaea2</link>
			<pheedo:origLink>http://feedproxy.google.com/~r/PHPMaster_feed/~3/y6hnYOzYB8U/?utm_source=rss&amp;#038;utm_medium=rss&amp;#038;utm_campaign=phpmaster-how-i-chose-my-programming-editor</pheedo:origLink>
			<comments>http://feedproxy.google.com/~r/PHPMaster_feed/~3/y6hnYOzYB8U/#comments</comments>
			<pubDate>Fri, 13 Jan 2012 23:32:42 +0000</pubDate>
			<dc:creator>J Armando Jeronymo</dc:creator>
			<category><![CDATA[.NET]]></category>
			<category><![CDATA[Color]]></category>
			<category><![CDATA[Community]]></category>
			<category><![CDATA[debug]]></category>
			<category><![CDATA[Design]]></category>
			<category><![CDATA[DR]]></category>
			<category><![CDATA[frameworks]]></category>
			<category><![CDATA[HTML5]]></category>
			<category><![CDATA[Java]]></category>
			<category><![CDATA[JavaScript]]></category>
			<category><![CDATA[Open Source]]></category>
			<category><![CDATA[PHP]]></category>
			<category><![CDATA[plugins]]></category>
			<category><![CDATA[S3]]></category>
			<category><![CDATA[UX]]></category>
			<category><![CDATA[Web Tech]]></category>
			<category><![CDATA[Windows]]></category>
			<category><![CDATA[netbeans]]></category>
			<guid
isPermaLink="false">http://www.sitepoint.com/?p=50239</guid>
			<description><![CDATA[<img
width="50" height="50" src="http://www.sitepoint.com/wp-content/uploads/1/files/2012/01/aebc63699691-150x150-50x50.jpg" class="attachment-thumbnail wp-post-image" alt="Thumbnail" title="Thumbnail" /> For many years I used a code editor that is now discontinued by its developers, and the introduction of HTML5 and CSS3 led me to look for an editor that supports the new tags and properties. In this article I’ll share the criteria and process I used to find an editor suitable for making quick fixes and a development environment for large-scale projects. My initial candidate list contained over 30 popular Linux, Java, Windows and XUL software packages which had at least one stable release after January 1, 2010: Arachnophilia, Bluefish, Bluegriffon, CoffeeCup HTML Editor, Dreamweaver, Eclipse PDT, Emacs, Expression Web, Geany, gedit, HTML-Kit, jEdit, Kate, KDevelop, Komodo Edit, KWrite, Netbeans, Notepad++, Notepad2, OpenBEXI, PHPEdit, PHPEd Pro, PHPStorm, Programmer’s Notepad, PSPad, RadPHP, Scite, SeaMonkey, Vim, WebDev, WebMatrix, and Zend Studio. You can google each program for their specific details<br clear="both" style="clear: both;"/>
<br clear="both" style="clear: both;"/>
<a href="http://ads.pheedo.com/click.phdo?s=d2742c1f2b255b001d79b0adffcaaea2&p=1"><img alt="" style="border: 0;" border="0" src="http://ads.pheedo.com/img.phdo?s=d2742c1f2b255b001d79b0adffcaaea2&p=1"/></a>
<img alt="" height="0" width="0" border="0" style="display:none" src="http://tags.bluekai.com/site/5148"/><img alt="" height="0" width="0" border="0" style="display:none" src="http://insight.adsrvr.org/track/evnt/?ct=0:8pyu3gz&adv=wouzn4v&fmt=3"/>]]></description>
			<content:encoded><![CDATA[<img
width="50" height="50" src="http://www.sitepoint.com/wp-content/uploads/1/files/2012/01/aebc63699691-150x150-50x50.jpg" class="attachment-thumbnail wp-post-image" alt="Thumbnail" title="Thumbnail" /><p></p><p><img
src="http://www.sitepoint.com/wp-content/uploads/2012/01/aebc63699691-150x150-50x50.jpg" alt="" /> For many years I used a code editor that is now discontinued by its developers, and the introduction of HTML5 and CSS3 led me to look for an editor that supports the new tags and properties. In this article I’ll share the criteria and process I used to find an editor suitable for making quick fixes and a development environment for large-scale projects. My initial candidate list contained over 30 popular Linux, Java, Windows and XUL software packages which had at least one stable release after January 1, 2010: Arachnophilia, Bluefish, Bluegriffon, CoffeeCup HTML Editor, Dreamweaver, Eclipse PDT, Emacs, Expression Web, Geany, gedit, HTML-Kit, jEdit, Kate, KDevelop, Komodo Edit, KWrite, Netbeans, Notepad++, Notepad2, OpenBEXI, PHPEdit, PHPEd Pro, PHPStorm, Programmer’s Notepad, PSPad, RadPHP, Scite, SeaMonkey, Vim, WebDev, WebMatrix, and Zend Studio. You can google each program for their specific details</p><p>Read More:<br
/> <a
title="PHPMaster: How I Chose My Programming Editor" href="http://feedproxy.google.com/~r/PHPMaster_feed/~3/y6hnYOzYB8U/" target="_blank">PHPMaster: How I Chose My Programming Editor</a></p> <span
id="pty_trigger"></span><div
style='padding:20px 0px 50px 0px;'><div
style='float:left;padding-left:40px;'><div
id='div-gpt-ad-1335489406190-0' style='width:300px; height:100px;'> <script type='text/javascript'>googletag.cmd.push(function() { googletag.display('div-gpt-ad-1335489406190-0'); });</script> </div></div><div
style='float:right;padding-right:40px;'><div
id='div-gpt-ad-1335489406190-1' style='width:300px; height:100px;'> <script type='text/javascript'>googletag.cmd.push(function() { googletag.display('div-gpt-ad-1335489406190-1'); });</script> </div></div><div
style='clear:both'></div></div><div
style='clear:both'></div><br clear="both" style="clear: both;"/>
<br clear="both" style="clear: both;"/>
<a href="http://ads.pheedo.com/click.phdo?s=d2742c1f2b255b001d79b0adffcaaea2&p=1"><img alt="" style="border: 0;" border="0" src="http://ads.pheedo.com/img.phdo?s=d2742c1f2b255b001d79b0adffcaaea2&p=1"/></a>
<img alt="" height="0" width="0" border="0" style="display:none" src="http://tags.bluekai.com/site/5148"/><img alt="" height="0" width="0" border="0" style="display:none" src="http://insight.adsrvr.org/track/evnt/?ct=0:8pyu3gz&adv=wouzn4v&fmt=3"/>]]></content:encoded>
			<wfw:commentRss>http://feedproxy.google.com/~r/PHPMaster_feed/~3/y6hnYOzYB8U/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		</item>
		<item>
			<title>PHPMaster: Zend Job Queue</title>
			<link>http://www.pheedcontent.com/click.phdo?i=d6ad78338cf6575874bd28477bab4122</link>
			<pheedo:origLink>http://feedproxy.google.com/~r/PHPMaster_feed/~3/geE_wnRVORE/?utm_source=rss&amp;#038;utm_medium=rss&amp;#038;utm_campaign=phpmaster-zend-job-queue</pheedo:origLink>
			<comments>http://feedproxy.google.com/~r/PHPMaster_feed/~3/geE_wnRVORE/#comments</comments>
			<pubDate>Wed, 11 Jan 2012 23:48:32 +0000</pubDate>
			<dc:creator>Alex Stetsenko</dc:creator>
			<category><![CDATA[.NET]]></category>
			<category><![CDATA[Cloud]]></category>
			<category><![CDATA[Community]]></category>
			<category><![CDATA[cron]]></category>
			<category><![CDATA[DR]]></category>
			<category><![CDATA[headers]]></category>
			<category><![CDATA[Java]]></category>
			<category><![CDATA[Mobile]]></category>
			<category><![CDATA[node]]></category>
			<category><![CDATA[PHP]]></category>
			<category><![CDATA[PHP & MySQL Tutorials]]></category>
			<category><![CDATA[queues]]></category>
			<category><![CDATA[RoR]]></category>
			<category><![CDATA[Tutorial]]></category>
			<category><![CDATA[Web Tech]]></category>
			<category><![CDATA[tutorial]]></category>
			<guid
isPermaLink="false">http://www.sitepoint.com/?p=50119</guid>
			<description><![CDATA[<img
width="50" height="50" src="http://www.sitepoint.com/wp-content/uploads/1/files/2012/01/b938zendqueue_600007-150x150-50x50.jpg" class="attachment-thumbnail wp-post-image" alt="Thumbnail" title="Thumbnail" /> Web applications usually follow a synchronous communication model. However, non-interactive and long-running tasks (such as report generation) are better suited for asynchronous execution. One way to off-load tasks to run at a later time, or even on a different server, is use the Job Queue module available as a part of Zend Server 5 (though not as part of the Community Edition). Job Queue allows job scheduling based on time, priority, and even dependencies. <br clear="both" style="clear: both;"/>
<br clear="both" style="clear: both;"/>
<a href="http://ads.pheedo.com/click.phdo?s=d6ad78338cf6575874bd28477bab4122&p=1"><img alt="" style="border: 0;" border="0" src="http://ads.pheedo.com/img.phdo?s=d6ad78338cf6575874bd28477bab4122&p=1"/></a>
<img alt="" height="0" width="0" border="0" style="display:none" src="http://tags.bluekai.com/site/5148"/><img alt="" height="0" width="0" border="0" style="display:none" src="http://insight.adsrvr.org/track/evnt/?ct=0:8pyu3gz&adv=wouzn4v&fmt=3"/>]]></description>
			<content:encoded><![CDATA[<img
width="50" height="50" src="http://www.sitepoint.com/wp-content/uploads/1/files/2012/01/b938zendqueue_600007-150x150-50x50.jpg" class="attachment-thumbnail wp-post-image" alt="Thumbnail" title="Thumbnail" /><p></p><p><img
src="http://www.sitepoint.com/wp-content/uploads/2012/01/b938zendqueue_600007-150x150-50x50.jpg" /> Web applications usually follow a synchronous communication model. However, non-interactive and long-running tasks (such as report generation) are better suited for asynchronous execution. One way to off-load tasks to run at a later time, or even on a different server, is use the Job Queue module available as a part of Zend Server 5 (though not as part of the Community Edition). Job Queue allows job scheduling based on time, priority, and even dependencies.</p><p>See the article here:<br
/> <a
target="_blank" href="http://feedproxy.google.com/~r/PHPMaster_feed/~3/geE_wnRVORE/" title="PHPMaster: Zend Job Queue">PHPMaster: Zend Job Queue</a></p> <span
id="pty_trigger"></span><div
style='padding:20px 0px 50px 0px;'><div
style='float:left;padding-left:40px;'><div
id='div-gpt-ad-1335489406190-0' style='width:300px; height:100px;'> <script type='text/javascript'>googletag.cmd.push(function() { googletag.display('div-gpt-ad-1335489406190-0'); });</script> </div></div><div
style='float:right;padding-right:40px;'><div
id='div-gpt-ad-1335489406190-1' style='width:300px; height:100px;'> <script type='text/javascript'>googletag.cmd.push(function() { googletag.display('div-gpt-ad-1335489406190-1'); });</script> </div></div><div
style='clear:both'></div></div><div
style='clear:both'></div><br clear="both" style="clear: both;"/>
<br clear="both" style="clear: both;"/>
<a href="http://ads.pheedo.com/click.phdo?s=d6ad78338cf6575874bd28477bab4122&p=1"><img alt="" style="border: 0;" border="0" src="http://ads.pheedo.com/img.phdo?s=d6ad78338cf6575874bd28477bab4122&p=1"/></a>
<img alt="" height="0" width="0" border="0" style="display:none" src="http://tags.bluekai.com/site/5148"/><img alt="" height="0" width="0" border="0" style="display:none" src="http://insight.adsrvr.org/track/evnt/?ct=0:8pyu3gz&adv=wouzn4v&fmt=3"/>]]></content:encoded>
			<wfw:commentRss>http://feedproxy.google.com/~r/PHPMaster_feed/~3/geE_wnRVORE/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		</item>
		<item>
			<title>How to Customize the WordPress 3.3 Toolbar</title>
			<link>http://www.pheedcontent.com/click.phdo?i=80dcfe5e7d62b4868fc05eba8bf465e9</link>
			<pheedo:origLink>http://www.sitepoint.com/change-wordpress-33-toolbar/?utm_source=rss&amp;#038;utm_medium=rss&amp;#038;utm_campaign=change-wordpress-33-toolbar</pheedo:origLink>
			<comments>http://www.sitepoint.com/change-wordpress-33-toolbar/#comments</comments>
			<pubDate>Wed, 11 Jan 2012 16:26:02 +0000</pubDate>
			<dc:creator>Craig Buckler</dc:creator>
			<category><![CDATA[PHP]]></category>
			<category><![CDATA[PHP & MySQL Reviews and Apps]]></category>
			<category><![CDATA[plugins]]></category>
			<category><![CDATA[wordpress]]></category>
			<category><![CDATA[toolbar]]></category>
			<category><![CDATA[WordPress]]></category>
			<guid
isPermaLink="false">http://www.sitepoint.com/?p=49516</guid>
			<description><![CDATA[<img
width="50" height="50" src="http://www.sitepoint.com/wp-content/uploads/1/files/2010/04/286-easier-wordpress-1-thumb1-50x50.jpg" class="attachment-thumbnail wp-post-image" alt="286-easier-wordpress-1-thumb" title="286-easier-wordpress-1-thumb" />Craig reveals how you can add and remove menu items from the new WordPress 3.3 toolbar.<br clear="both" style="clear: both;"/>
<br clear="both" style="clear: both;"/>
<a href="http://ads.pheedo.com/click.phdo?s=80dcfe5e7d62b4868fc05eba8bf465e9&p=1"><img alt="" style="border: 0;" border="0" src="http://ads.pheedo.com/img.phdo?s=80dcfe5e7d62b4868fc05eba8bf465e9&p=1"/></a>
<img alt="" height="0" width="0" border="0" style="display:none" src="http://tags.bluekai.com/site/5148"/><img alt="" height="0" width="0" border="0" style="display:none" src="http://insight.adsrvr.org/track/evnt/?ct=0:8pyu3gz&adv=wouzn4v&fmt=3"/>]]></description>
			<content:encoded><![CDATA[<img
width="50" height="50" src="http://www.sitepoint.com/wp-content/uploads/1/files/2010/04/286-easier-wordpress-1-thumb1-50x50.jpg" class="attachment-thumbnail wp-post-image" alt="286-easier-wordpress-1-thumb" title="286-easier-wordpress-1-thumb" /><p></p><p>You can make the WordPress interface easier for clients by removing <a
href="http://www.sitepoint.com/how-to-hide-menus-in-wordpress/">unnecessary menus</a>, <a
href="http://www.sitepoint.com/wordpress-easy-administration-plugin-2/">widgets and meta boxes</a>. However, in WordPress 3.3, the admin and header bars have been merged to create a single toolbar. It may also contain options you want to hide&hellip;</p><h2>The WordPress Toolbar API</h2><p>The new toolbar is defined using a single <code>WP_Admin_Bar</code> object (see wp-includes/class-wp-admin-bar.php). This provides a number of useful methods:</p><ul><li><code>add_node()</code> &#8212; add a new toolbar item</li><li><code>remove_node()</code> &#8212; remove a toolbar item</li><li><code>get_node()</code> &#8212; fetch a node&#8217;s properties</li><li><code>get_nodes()</code> &#8212; fetch a list of all nodes</li></ul><h2>Removing Toolbar Items</h2><p>We&#8217;re going to place our code into a reusable plugin named wp-content/plugins/change-toolbar.php but you could put it within your theme&#8217;s functions.php file.</p><p>WordPress plugins require a header at the top of the file, e.g.</p><pre><code>
&lt;?php
/*
Plugin Name: Change Toolbar
Plugin URI: http://www.sitepoint.com/change-wordpress-33-toolbar
Description: Modifies the WordPress 3.3+ toolbar.
Version: 1.0
Author: Craig Buckler
Author URI: http://optimalworks.net/
License: GPL2
*/
</code></pre><p>We now require a single function where our changes will be made:<div
id='div-gpt-ad-1328644474660-10' style='width:728px; height:90px;'> <script type='text/javascript'>googletag.cmd.push(function() { googletag.display('div-gpt-ad-1328644474660-10'); });</script> </div></p><pre><code>
function change_toolbar($wp_toolbar) {
	/* ... code to go here ... */
}
</code></pre><p>followed by an action hook which runs the function and passes the toolbar object:</p><pre><code>
add_action('admin_bar_menu', 'change_toolbar', 999);
</code></pre><p>We can now remove toolbar items within the <code>change_toolbar()</code> function. For example, the following line hides the WordPress logo and help sub-menu by referencing its ID, &#8220;wp-logo&#8221;:</p><pre><code>
$wp_toolbar-&gt;remove_node('wp-logo');
</code></pre><p>To remove other items you need to discover what ID they&#8217;re using. You could delve into the PHP code but there&#8217;s an easier way:</p><ul><li>Open Firebug or your favorite Firebug-like development console.</li><li>Locate the toolbar item you want to remove (in most browsers you can right-click the item and select &#8220;Inspect Element&#8221;).</li><li>Navigate up the parent nodes until you find an LI tag. It will have an ID starting &#8220;wp-admin-bar-&#8221; followed by the internal ID code:</li></ul><p><img
src="http://blogs.sitepointstatic.com/images/tech/619-wp33-admin-bar-id.png" width="523" height="206" alt="WordPress toolbar ID" class="center" /></p><p>In this example, the Comments item is highlighted. Therefore, to remove it from the toolbar, we use:</p><pre><code>
$wp_toolbar-&gt;remove_node('comments');
</code></pre><h2>Adding Toolbar Items</h2><p>We can add toolbar items within the same function. The syntax is:</p><pre><code>
$wp_toolbar-&gt;add_node($arg);
</code></pre><p>Where $arg is an associative array containing:</p><ul><li><code>id</code> &#8212; the item&#8217;s ID</li><li><code>title</code> &#8212; the title text</li><li><code>parent</code> &#8212; the parent menu ID (optional)</li><li><code>href</code> &#8212; the link URL (optional)</li><li><code>group</code> &#8212; true if the node is a group (optional)</li><li><code>meta</code> &#8212; another array providing other keys including: html, class, onclick, target, title, tabindex</li></ul><p>Let&#8217;s add a &#8220;Help&#8221; item which links to our support pages:</p><pre><code>
$wp_toolbar-&gt;add_node(array(
	'id' =&gt; 'myhelp',
	'title' =&gt; 'Help',
	'href' =&gt; 'http://mysite.com/support/',
	'meta' =&gt; array('target' =&gt; 'help')
));
</code></pre><p>We could now add an email support link within a sub-menu by referencing the &#8216;myhelp&#8217; ID in the <code>parent</code>:</p><pre><code>
$wp_toolbar-&gt;add_node(array(
	'id' =&gt; 'mysupport',
	'title' =&gt; 'Email Support',
	'parent' =&gt; 'myhelp',
	'href' =&gt; 'mailto:support@mysite.com?subject=support%20request'
));
</code></pre><p>I hope you find it useful &#8212; it&#8217;s easy to customize the whole WordPress 3.3 toolbar using a few API calls.</p> <span
id="pty_trigger"></span><div
style='padding:20px 0px 50px 0px;'><div
style='float:left;padding-left:40px;'><div
id='div-gpt-ad-1335489406190-0' style='width:300px; height:100px;'> <script type='text/javascript'>googletag.cmd.push(function() { googletag.display('div-gpt-ad-1335489406190-0'); });</script> </div></div><div
style='float:right;padding-right:40px;'><div
id='div-gpt-ad-1335489406190-1' style='width:300px; height:100px;'> <script type='text/javascript'>googletag.cmd.push(function() { googletag.display('div-gpt-ad-1335489406190-1'); });</script> </div></div><div
style='clear:both'></div></div><div
style='clear:both'></div><br clear="both" style="clear: both;"/>
<br clear="both" style="clear: both;"/>
<a href="http://ads.pheedo.com/click.phdo?s=80dcfe5e7d62b4868fc05eba8bf465e9&p=1"><img alt="" style="border: 0;" border="0" src="http://ads.pheedo.com/img.phdo?s=80dcfe5e7d62b4868fc05eba8bf465e9&p=1"/></a>
<img alt="" height="0" width="0" border="0" style="display:none" src="http://tags.bluekai.com/site/5148"/><img alt="" height="0" width="0" border="0" style="display:none" src="http://insight.adsrvr.org/track/evnt/?ct=0:8pyu3gz&adv=wouzn4v&fmt=3"/>]]></content:encoded>
			<wfw:commentRss>http://www.sitepoint.com/change-wordpress-33-toolbar/feed/</wfw:commentRss>
			<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>
<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using memcached
Database Caching 62/65 queries in 0.233 seconds using memcached
Object Caching 2999/3002 objects using memcached

Served from: www.sitepoint.com @ 2012-05-16 08:16:07 -->
