Archive for June 27th, 2006

Zend Developer Zone: Learning PHP & MySQL (a Book Review)

On the Zend Developer Zone today, Cal Evans has posted his own review of the O’Reilly book “Learning PHP & MySQL” (by Michele E. Davis and Jon A. Phillips).

Learning PHP & MySQL by Michele E. Davis and Jon A. Phillips is targeting graphic designers, Flash developers and others who build web sites but want to know more about the programming side of things. It assumes a basic knowledge of HTML and the web in general. There’s really nothing in this book that anyone with an interest in programming and access to a computer couldn’t use to expand their skills a bit.

He goes on to talk about what the book contains (and what it doesn’t) and some of his inital impressions about the level of content (”There’s really no need to show us a graphic of the Apache EULA screen. Just tell us to ‘Install Apache by following the on-screen instructions.’”).

He reiterates how basic the level of the book is by mentioning the introductory chapters on PHP, MySQL, and using them together. Of course, from there, the topics do get a bit harder - security, PEAR, regular expressions, etc. The book rounds itself out with a sample app - a blog.

Obviously, this is just a basic summary of what Cal has said, so be sure to check out the rest of the review.

Continue Reading · Add comment

CodeSnipers.com: Building Clean URLs Into a Site

On CodeSnipers.com today, Peter Harkins talks about a method, using regular expressions and Apache to turn ugly, GET-laden URLs in your application into clean, search engine friendly URLs without altering the underlying scripts.

So we have two goals. First, requests for the new URL are internally rewritten to call the existing scripts without users ever knowing they exist. Second, requests for the old URLs get a 301 redirect to the new URLs so that search engines and good bookmarks immediately switch to the new URLs.

He starts with a sample .htaccess file, showing a simple RewriteRule to take in the request and remap them back to the old PHP script’s input format. They work through a few more changes, noting issues along the way (in case you hit them too) and end up with a simple, and much easier way to achieve clean URL bliss.

Continue Reading · Add comment

PHPit.net: Using globals in PHP

In this new tutorial from PHPit.net today, Dennis Pallett talks about using globals in PHP, desscribing what they are and how to use them.

Whenever you’re developing a new large-scale PHP script, you’re bound to use global variables, since some data needs to be used by multiple parts of your script. Good examples of global data are script settings, database connections, user credentials and more. There are many ways of making this data global, but the most commonly used way is to use the global keyword, which we will explore later on in this article.

It’s good that he mentions right from the start that most global data is a bad idea, and can really start to clutter up an application. He does help the reader prevent this, though, through the use of a few handy techniques (and design patterns).

He looks first at the “global” keyword and its use, followed by three reasons that it’s not all that favorable to use. He gives other options for the “just make it global” thinking, including passing the values in function calls, passing by reference, and using the Singleton and Registry patterns to contain things a bit more. He even includes a wrapper for the registry to handle the only other globals left - the superglobals - with the same registry functionality.

Continue Reading · Add comment

Tutorial: A Simple Sessions Tutorial

Developers just starting out with PHP have a pretty easy time getting the basics down, but there are a few things that can take a little time to get ones head around. I just looking around the PHP community, I’ve noticed a bit of a barrier when it comes to getting aquainted with sessions. So, to help overcome this bump in the road, here’s a brief introduction to sessions - what they are and how they can help you.

Click here for the full article!

Continue Reading · Add comment

php|architect: Using PHP5’s SOAP Support

On php|architect’s A/R/T article repository today, there’s a new tutorial from Paul Reinheimer covering the SOAP support that’s built into usual installations of PHP5.

One of PHP5’s landmark new features is the inclusion of a library of SOAP functions that make it easy to interact with SOAP based web services. While these functions are very powerful, learning to use them the first time can be a little intimidating. The goal of this article is to introduce you to PHP5’s basic SOAP functions and how they are used through a working example.

The tutorial dosen’t teach you about what SOAP is, so you’ll need to find a different resource for that. If you’ve already added that to your ever-growing list of web protocols you know, then you’ll feel right at home. For his examples, he uses the Amazon Web Services interface.

He jumps right in, defining a new SoapClient object for a remote resource, and shows how to display the WSDL results and make a call to the API based on the information it provides (in this case, a KeywordRequest call). He shows the response message this sample call will get, and brings the code pieces from the article together in a complete client to display them.

Continue Reading · Add comment