Heigh-ho, it’s off to print we go
July 29th, 2008
I got word from the production manager of my latest book, PHP Object-Oriented Solutions, that everything has gone to schedule, and the book shipped to the printers just before the weekend. It usually takes about three weeks after sending all the chapters and images to the printers before a book appears on the shelves in bookstores. I’m told that 18 August is now the official publication date. The eBook version should be ready about a week earlier (a link will appear on the book’s page on the friends of ED site as soon as it’s available).
I’m quite pleased with the way the book has turned out. Well, I would be, wouldn’t I?
It’s aimed at readers who already have a good understanding of PHP, but it doesn’t assume any prior knowledge of object-oriented programming (OOP). Although the book is devoted entirely to OOP in PHP, it makes the point right from the start that OOP isn’t a replacement for everything that you have already learned, but an extra, very powerful tool to add to your skillset. The book concentrates on a small number of custom-built classes that can be reused in a variety of projects. It also uses some of the built-in classes, such as DateTime, DateTimezone, SimpleXMLElement, and XMLWriter.
One chapter that turned into a voyage of discovery for me deals with the Standard PHP Library (SPL). Even though SPL has been part of PHP for more than four years, the documentation is difficult to follow. Once I peeled away the mysteries of the various iterators, I realized just how powerful they are. An iterator lets you use a foreach loop on an object, which is pretty useful in itself; but what makes iterators really useful is the way you can combine them. For example, I used a DirectoryIterator in combination with a RegexIterator and a LimitIterator to display a long list of images in a folder just ten at a time. Without SPL, it would have taken a lot of code. With SPL, just half a dozen lines.
PHP Object-Oriented Solutions is exclusively focused on PHP 5 (and ready for PHP 6 when it eventually emerges). The code will not work with PHP 4.
21 Comments Add your own
1. jeff doyle | July 29th, 2008 at 8:45 pm
Hello… can anyone help me? I have followed the instructions in Powers book… “Foundation PHP for dreamweaver 8″ when i installed PHP it crashed by apache that was already installed……. yet another frustration in learning the web… why is it that nothing works in the web development space? … not impressed!!!!!!!!!!!!!!!
2. David Powers | July 29th, 2008 at 9:51 pm
Jeff, perhaps you should ask yourself why thousands of people manage to get things to work. I’m not doubting that Apache crashed, but the instructions in that book are accurate. Usually, when something goes wrong, it’s a case of operator error. Dozens of times I’ve had readers swear they following my instructions “to the letter”, only to admit later that they had missed something out.
If you want help, you need to say exactly what happened.
3. Eric Hobart | July 30th, 2008 at 5:42 pm
Hello David,
I purchased your PHP Solutions book (copyright 2006) and have been using it for validation on a few forms at my job here at Norwich University in Northfield, Vermont.
The script works well, and I’ve coupled it with js scriptaculous validation.
Unfortunately, we’re getting hit by a spam bot … nothing destructive, just tons of spam being delivered to our Admissions folks.
I was asked to consider Captcha, but that approach is not accessible to vision-impaired and some color blind visitors. I’d like to add an empty field and prevent the form from submitting if the field is filled in. I’d hide the field from sighted visitors with css and include a caution not to fill it in in both the label and title.
But I’m not sure where to introduce that into your script without breaking it. I tried adding an if, else, but ended up forcing a redirect before a visitor would have a chance to load the page.
I’d really like to stay with your script as the core.
I’d also be willing to pay (within reason) if your could massage your script, since I lack a strong PHP programmer and am not one myself.
Thanks for taking the time,
Eric Hobart
4. David Powers | July 30th, 2008 at 6:13 pm
Hi Eric, I answered a similar question in the friends of ED forum about a year ago. Here’s direct link to the solution, which is actually very simple. Let me know if that answers your problem.
There are two things you and others can do: spread the word about my books to encourage others to buy them, and follow the Amazon links on my site. I get a small commission for anything bought after using one of the links (you don’t need to buy the item that’s linked to, anything qualifies as long as you remain within the Amazon site after leaving mine).
5. Eric Hobart | July 30th, 2008 at 8:52 pm
Thanks for the response, David.
I haven’t tried the solution, but it sounds like a winner. I’ll throw some explanatory text in the label and title to help ensure folks using screenreaders (or with css disabled) don’t accidentally fill in the spam catcher field.
And I’ll be sure and take a look at your other books following the route that will give you some Amazon $.
I’m a rookie at PHP but am eager to learn … which of your books would you recommend … except for PHP solutions, which I already have.
You have a clear writing style, and I didn’t run into any misunderstandings in the solutions book.
Eric
6. Eric Hobart | July 31st, 2008 at 1:48 pm
David,
I’m playing with the solution you suggested. Since I’m a novice, I’m not sure how to follow these instructions:
”
Only an automated script should ever fill in the bogus input field. You can divert to a spam trap everything that contains “Suspected spam” as the subject line. After checking it for a while, and satisfying yourself that it is genuinely spam, you can change your processing script so that it simply ignores any submissions that have content in the bogus field.
”
Can you tell me if the following, introduced at the top of your script below the // process the email comment, looks like it will send any submissions that include a value for the bogus field will send to an email spam trap address:
*** begin php code snippet ***
// process the email
if (array_key_exists(’submit’, $_POST)) {
if (!empty($_POST['email_block'])) {
$subject = ‘Suspected spam’;
$to = ’sem-spamtrap@norwich.edu’; // spam trap email address
}
else {
$subject = ‘Secure the Future - undergraduate information request’;
$to = ’sem-general@norwich.edu’; // recipient email address
}
// list expected fields
*** end php code snippet ***
I created a bogus field with id and name: email_block
If I’m on the right track, could I use this code to send the spam submissions back to the sender once I’m confident only spam bots are filling in the bogus field:
*** begin php code snippet ***
// process the email
if (array_key_exists(’submit’, $_POST)) {
if (!empty($_POST['email_block'])) {
$subject = ‘Suspected spam - undeliverable’;
$to = ['email']; // spammer email address
}
else {
$subject = ‘Secure the Future - undergraduate information request’;
$to = ’sem-general@norwich.edu’; // recipient email address
}
// list expected fields
*** end php code snippet ***
I considered using recaptcha, but incorporating that into your php validation looks like it might be more complex than this approach.
Thanks again for all your help. If you can recommend a good beginning php book by anyone, I’ll be happy to access it via links that give you some Amazon $.
Eric
7. Kevin Cheng | August 1st, 2008 at 3:05 am
Hi, David,
I’ve been reading and referring to your “PHP Solutions” book for coding a Web site, and your book has been very informative, and your explanations are clear (Fantastic job on this book!). But just now I’m looking to integrate some code in code libraries written by others, and much of this is written in OOP (i.e. class definitions, etc). I have no previous OOP experience, and so I went on Amazon, and searched for “object oriented php” and lo and behold, your upcoming book is on the list. The timing couldn’t be better, and I’m looking forward to buying and reading it. Hopefully there will be downloadable code as in the “PHP Solutions” book.
8. David Powers | August 1st, 2008 at 6:52 am
@Eric. Yes, that should work, and you could use it to bounce the spam back to the originator. What I do is simply send the spam directly to my junk mail folder.
As for beginner’s books on PHP, Larry Ullman’s books are very popular, so he must be doings something right. I must admit, though, that I haven’t read his books. I believe that a fourth edition of “PHP and MySQL Web Development” by Luke Welling and Laura Thomson is due out in September. I read the first edition, and found it excellent. The first few chapters were a crash course in PHP syntax, so needed to be taken very slowly. The rest of the book was a solid set of practical tutorials. If the fourth edition is as good as the first, you should find it very helpful. Be warned, though, it’s a big book, and a lot of the code in the first edition was in the accompanying CD ROM, so you needed to jump back and forth to see the full code.
@Kevin. Thanks for your comments. I hope you find “PHP Object-Oriented Solutions” as helpful. The downloadable code is already available on the friends of ED site. All I’m waiting for now is for the printers to do their magic.
9. speculumcm | August 18th, 2008 at 3:37 pm
Hi David,
I’ve already purchased PHP Object-Oriented Solutions
a week ago. Today I saw in Amazon that it’s in stock, Great! So it means that soon they’re going to Ship it on September 3, 2008 according to their site info.
Hopping this book going to be another successful for you and another great aid in PHP for us learners.
Kindest regards
10. David Powers | August 18th, 2008 at 3:49 pm
Hi, speculumcm. Thanks for buying my new book. Hope you enjoy it. How weird that Amazon say the book is in stock, but they’re not going to ship it for another couple of weeks. I don’t know if there has been some last minute glitch with printing. I haven’t received my own copies yet. But “in stock” should mean “available for shipping now”. I wonder what Amazon’s playing at?
11. speculumcm | August 19th, 2008 at 12:25 am
Weird indeed, last time I purchased a package of books (edited from Ed of Friends and Apress) to Amazon they divided in two, one package came from US which was OK but the second one came from German! I had to pay extra taxes thanks for that.
I’m sure they’re going to ship the book sooner since it said that: Shipping estimate:
12. Miroslav | August 22nd, 2008 at 11:16 am
Hi David,
I was impatiently waiting for your new book ‘PHP Object-Oriented Solutions’ by unfortunately I still can’t get a copy.
The new book, from yesterday available worldwide, I plan to present in some Serbian IT magazines, hoping that trough translation it will become available for general IT public and those who do not read in English.
Although as a journalist I might be eligible for a free copy of new book I just tried to porches E-Book on-line, but unfortunately my country, Serbia is not included on the Paypal country list and other option you usually offer – use of major Credit Cards – is not activated this time.
So I hope that you can help me to purchase and get a copy of ‘PHP Object-Oriented Solutions’ as quick as possible.
Best regards,
Miroslav Milekic
Journalist
PS: Yesterday I sent the similar e-mail to PR Department of Apress (Julie Miller) but I didn’t get any answer yet. What a PR!
13. David Powers | August 22nd, 2008 at 1:33 pm
Hi Miroslav, I have passed your request onto my product manager. Unfortunately, he’s out of the office until Tuesday so I’m afraid you won’t get an answer before then.
14. Prabhjeet | August 25th, 2008 at 12:15 pm
just bought your new e-book OOP PHP. Very excited to read it. Hope I will learn what i want. Thanks for writing this book.

15. David Powers | August 25th, 2008 at 12:21 pm
Thanks for buying, Prabhjeet.
16. Jos Vecht | September 2nd, 2008 at 12:44 pm
Hi David Powers.
I learned much from your books allready even being a non-programmer. I now started reading your latest book PHP Object-Oriented Solutions.
I have a question. You suggest not to use PHP4 anymore. What about MySQL? A client uses MySQL 4.0.15 is that acceptable nowadays? The same client uses PHP Version 4.4.8 I am afraid.
Thanks for all your great books,
Jos
17. Miroslav | September 11th, 2008 at 7:50 pm
Soon it will be a month since I tried to buy E-copy of your new book but no lack.
Several Tuesdays passed by but your product manager did not get in touch with me yet.
I wonder how superb IT author as you are have such lousy logistic?
Do your product manager and PR people from Apress think to earn their salaries when you can’t sell your books?
Do I have to make en extra effort and to try to find pirated copy somewhere on the Internet?
Best Regards
Miroslav
18. Dan Gayle | October 14th, 2008 at 6:15 am
I’ve been going through your PHP Solutions one bit at a time and I wanted to say that it is fantastic! I was already wondering what book I was going to buy after it, not looking forward to having to spend a lot of time hunting down something authoritative yet easy to read and understand.
Since my work requires me to start learning the Code Igniter framework, I am getting confused about all of the “Foo extends Controller” stuff which I have since learned is object oriented programming jargon.
So I went to Barnes & Noble a week ago, and lo and behold! A PHP Object-Oriented Solutions book by the same guy as the PHP Solutions book!
I look forward to delving into it, since the first was so well written!
P.S.
I had no issues purchasing the e-book version of your book.
P.P.S.
I haven’t purchased the new book yet, so which is the best way to get it so that you get the most benefit?
Thanks!
Dan Gayle
19. David Powers | October 14th, 2008 at 9:25 am
Hi Dan, Glad you found “PHP Solutions” helpful. The way I get most benefit when you buy “PHP Object-Oriented Solutions” (or any other book) is through the Amazon link on my site. Perhaps an even greater benefit comes from spreading the word to your friends or through writing a review for an online bookstore.
By the way, “PHP Object-Oriented Solutions” deals exclusively with the PHP 5 object model. I have never used Code Igniter, but I understand it runs on both PHP 4 and PHP 5. For it to do so, it must be using PHP 4 objects. The PHP 5 object model is completely different. Since official support for PHP 4 came to an end two weeks before “PHP Object-Oriented Solutions” was published, it made no sense to cover the outdated PHP 4 model. From that point of view, my book might not be very helpful with regard to Code Igniter.
20. Randi Foos | November 9th, 2008 at 8:44 pm
I have been trying to download the files mentioned in my copy of PHP Solutions which I am using for a textbook in an online class from Art Institute of Pittsburgh. I keep getting a “page cannot be displayed” error message from Windows. Is it them or me? I’d really like to get that zip file so I can follow the lessons better.
Thanks,
Randi J. Foos
oomun2002@yahoo.com
21. David Powers | November 9th, 2008 at 11:29 pm
Randi, I suspect that the friends of ED site is just down temporarily. It seems to happen rather more frequently than it should, particularly at weekends.
Leave a Comment
Some HTML allowed:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>
Trackback this post | Subscribe to the comments via RSS Feed