Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > PHP/MySQL > BOOK: Professional PHP 5 ISBN: 978-0-7645-7282-1
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Professional PHP 5 ISBN: 978-0-7645-7282-1
This is the forum to discuss the Wrox book Professional PHP5 by Ed Lecky-Thompson, Heow Eide-Goodman, Steven D. Nowicki, Alec Cove; ISBN: 9780764572821
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional PHP 5 ISBN: 978-0-7645-7282-1 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old December 25th, 2005, 03:28 PM
Registered User
 
Join Date: Dec 2005
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Working Code for Chapter 4

I need help for the code on Chapter 4 about the Observer Pattern!
Not so many rows but this won't work. Maybe I'm not so an advanced Oop developer with Php5, but I had some problems even using the downloaded code from Wrox 'till now. The past Chapter 3 contact manager application simply won't work anyway, even with the wrox code. I had past Oop experiences with Java and Actionscript2. So I hope the mistakes are in the sintax and not in the logic of the application.
Please Wrox (and Authors): give more support and publish correct code! Books are intended to learn not to drive crazy! Other than that this is really an amazing book for the advanced developer.
  #2 (permalink)  
Old December 26th, 2005, 06:44 AM
Registered User
 
Join Date: Dec 2005
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Chapter 4 Observer Pattern (useful also for decorator) code:
After 15 minutes I fixed the code this way (changes in bold).

<?php
//OBSERVER PATTERN
//abstract_widget.php
//
interface Observer {
    public function update(Observable $subject);
}
//error in this class
abstract class Widget implements Observer {
    protected $internalData = array();

    abstract public function draw();

    public function update(Observable $subject) {
        $this->internalData = $subject->getData();
    }
}
....
?>

since abstract class Widget implements the Observer interface, its update method should accept the same parameters.
I hope I'll find a fix even for the chapter 3 application...
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Chapter 1 - Working Widget Code php4ever BOOK: Professional PHP 5 ISBN: 978-0-7645-7282-1 5 September 5th, 2013 02:16 PM
Chapter 4 - Two Views, not working for me... bigtalk BOOK: Beginning Ruby on Rails 1 January 3rd, 2008 07:30 AM
Chapter 6: store not working Giorgio84 BOOK: Beginning Ruby on Rails 2 June 17th, 2007 11:17 PM
Chapter 1: Greeting Not Working Joe3000 BOOK: Beginning Ruby on Rails 2 June 14th, 2007 10:54 AM



All times are GMT -4. The time now is 10:53 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.