Search:

Support for php|architect’s Guide to Programming with Zend Framework

about

This site is the official support site for php|architect’s Guide to Programming with Zend Framework. It is mantained by the book’s author, Cal Evans.

All posts are (c) Cal Evans and all rights are reserved. All comments are considered copyright of the original poster.

All posts and comments are released under Creative Commons Attribution-Noncommercial-No Derivative Works 3.0 United States License.


Creative Commons License

Reader's Comments

  1. Johnny B |

    Dear Cal Evans,

    I’m reading through the Guide to Programming ZF. Though, I’m finding a few bugs/errors/typos/missing instructions in the book (I’m documenting them for you and I’ll send you my findings), so far, it’s a nice beginners guide, I’m enjoying it.

    There’s one thing. I went to download the source code for example2. Does example 2 have to include all the source code for Zend Framework? Can just the application/bootstrap be included? It’s a lot of extra stuff to download ZF again if all we want is the sample source.

    Cheers!
    John

  2. admin |

    Hi John!

    Please email any errata to cal at calevans dot com. I’ll make sure that the manuscript gets updated and that they get published here under the errata category.

    In the next day or so I’ll try to create example_*_small that assumes you have ZF already installed. My goal was to make each example file “drop-in” but to do that you have to have the framework.

    Check back, when i get them done I will post them on the sourceCode page.

    Thanks for buying the book and thanks for taking the time to comment.

    =C=

  3. Jacek |

    Hi Cal,
    I like your book. I try to follow it very carefully.

    For now I’ve a problem with messages coming from ‘MemberController.php’ to ‘IndexController.php’ - example3.zip. I cannot get any message coming from the MemberController like for ex. ‘Welcome Back…’. It looks like ‘flashMessenger’ is not working. I’ve check my and your source code.

    Any idea?

    Best Regards,
    Jacek

  4. Cal Evans |

    Hi Jacek,

    No, not off the top of my head. You can check to make sure FlashMessanger is there, it should be in “lib\Zend\Controller\Action\Helper” however, if it’s missing you’ve probably got other problems.

    I’ve just rechecked the examples and it does seem to be working. Email me if you are still having problems and we’ll see if we can’t figure them out for you.

    =C=

  5. Erdal Yazicioglu |

    Hello Cal,

    I have just purchased you book(pdf version) and started reading.

    Thank you for all effort..

    I have a small question regarding to Chapter 4.

    I am trying to find explation of Member.php code in the book but I think I am lost. I found the Member.php in the source code but I could not find it in the book.

    Again congs for all your good work..

    Regards

  6. Brad Street |

    Hi Cal,

    I’ve purchased your book and created a development environment on my computer using XAMPP. I downloaded all of the examples as a single .zip file and extracted to my htdocs directory. I’ve begun working through the examples, but am having a difficult time getting them to work. The problem that is immediately apparent is that you’ve hard coded paths to the various directories in your index.php and IndexController like so:
    $lib_paths = array();
    $lib_paths[] = “c:/web/htdocs/application/”;
    $lib_paths[] = “c:/web/htdocs/lib/”;
    $frontController->setControllerDirectory(’c:/web/htdocs/application/controllers/’);

    Since this is not the path to my files, I’m forced to search through each file to correct each such occurence. Perhaps you could consider updating your code to be a bit more flexible such as:
    set_include_path(’.’ . PATH_SEPARATOR . ‘.././lib/’
    . PATH_SEPARATOR . ‘.././application/models’
    . PATH_SEPARATOR . get_include_path());

    This would be immensely helpful for me, and likely for others. I’m finding it difficult enough to try and grasp MVC & the Zend Framework without the added difficulty of troubleshooting non-working code.

    I hope you will find my criticism constructive, as it was intended.

    Thanks,

    Brad

  7. jamz |

    i have buy your book, i have try your source code, but why if i use .htaccess, the server getting error, i use xampp.

    thanks
    jamz

  8. Cal Evans |

    @jamz

    Hi! Thanks for writing and thanks for buying the book. Honestly I do not know why using an .htaccess file would cause your XAMPP install to throw an error. My knowledge of Apache is limited to things I’ve learned the hard way and I’ve not run across that one yet. :)

    You may want to post on their mailing list and see if anyone can suggest a solution.

    Thanks again for writing,
    =C=

  9. Phil Burrows |

    Hi Cal,
    I love the book, it has really helped me get to grips with Zend_Auth. I can’t quite work out the architecture for Zend_ACL though. Where should I be putting it in relation to the rest of my docs?

  10. Bogdan Stoica |

    I like your book not because it is a comprehensive guide to each component of ZF (which it isn’t), but because it’s more of a heads-up, an eye opener to the opportunities a good framework offers.

  11. Cal Evans |

    @Bogdan,

    I’m glad you like the book. No it’s not a comprehensive guide and wasn’t written to be one. Rob Allen is working on one of those and I have no doubt that it’s going to be great.

    =C=

  12. isse |

    i was wondering that will u be amending the erratas into the available PDF download. since i purchased the book+pdf option, it wud be nice if the erratas are amended into the PDF, so that i will have the updated version of the book.

  13. Cal Evans |

    @isse,

    That is totally in the hands of the publisher. I’ve collected all of it and if they will allow it, I would love to publish a cleaned up version.

    =C=

  14. ssin |

    Hi Cal,

    I’ve just started to read your book and have run into some problems. In chapter 3 (The Controller) I’ve made an additional controller called BaseController with the token code. When I run index.php I get the following error..

    Fatal error: Uncaught exception ‘Zend_Controller_Action_Exception’ with message ‘IndexController::generateToken() does not exist and was not trapped in __call()

    It seems like its looking for the generateToken() function in IndexController page. Is there a way to link IndexController and BaseController pages? Or is there another solution to this?

    Thanks.

  15. Cal Evans |

    Hi ssin!

    Yes, this is an exampel of where I changed the code in the example code but the change didn’t get propagated to the book. Please download the sample code and give it a try.

    =C=

  16. Owen Lees |

    Hi Cal, I have just purchased the book and am pleased with the easy to understand approach.

    I however have found a small issue in that in Chapter 3 you start to discuss plugins and helpers - you go on to discuss helpers and state that you approach plugins in Chapter 4 (which is called ‘The Model’).

    I have had a good dig around chapter four and cant find any reference to plugins in there (or for that matter in the book anywhere) and its a particularly useful bit of info that could have gone so well with the layout appendix at the back to bolster the layout code.

    Is there a plan to publish your section on plugins? I want to seperate the layout phtml and code without having to put code inside every controller - this I think is a most appropriate use of plugins (as per your book).

    Otherwise nice writing.

    Oo

  17. Clint |

    Cal -
    on page 50, ‘The Model’ chapter, you list source like so:

    public function processregisterAction() …

    shouldn’t that be ‘processRegisterAction()…’

    plus that’s how it’s given in the sample code available for download

  18. Cal Evans |

    @clint,

    Thanks!

    I’ll correct the book’s source.

    =C=

  19. Clint |

    Cal -

    Page 76 ‘Data Access’ reads:
    “Let’s take a look at the member model we created… In the method ‘checkEmail()’…”

    the method is ‘emailCheck()’, defined on page 47 “The Model”, and in source /application/models/Member.php

  20. Clint |

    Cal -

    on page 90 we unpack example4 and start replacing code, first adding BaseModel.php to the models and ripping out some other stuff.

    knowing Member extended BaseModel i made the haste-full mistake of also replacing member.php. every time after i logged in, i was always getting logged in as the first member in the database, regardless of creds (it was authenticating, just always setting the user to the first user in the DB).

    turns out example4.zip, the member.php file differs from what the book explains. on page 95, middle code block, :

    if($result->isValid()) {
    $memberArray = $authAdapter->getResultRowObject(’id’);
    $returnValue = (int)$memberArray->id;
    }// if($result->isValid())
    return $returnValue;

    is not in the example source code, instead:

    $result = $authAdapter->authenticate();

    return $result->isValid();

    that explains why i was always getting the user as the first user in the DB, the source i mistakenly replaced mine with was missing that $returnValue = (int)$memberArray->id; to set the correct ID

  21. Clint |

    correction of my previous post, it’s page 93, lower code block, not page 95. page got turned mid-post

  22. Clint |

    Cal -

    page 108, in the information block, reads:
    “That’s a good idea of you get charged …”

    i think that’s a typo and should be “if you get charged”

  23. dele |

    page 50(listing 3.10):

    $placesFinder = new Places();
    $this->view->places = $places->fetchLatest();
    ….

    $places should be $placesFinder!

  24. dele |

    Behind the scenes, startMvc() creates a Singleton instance of Zend_Layout and [the] registers a front
    controller …

    [the] - should be then! page 54

  25. dele |

    sorry the comments I made are not for this book. Sorry for any issues caused ;)

  26. Bill |

    In the book on page 23 the index.phtml I am constantly getting errors on line 1

    the only way I can get around this is to remove the question marks. Is this a typo ? what am I missing?

    Thanks

  27. Bill |

    Sorry above post the code was stripped
    this is the line that sets xml version and encoding.

  28. BillK |

    Thanks for publishing the book and the source code. It is helping me to get up to speed. One suggestion, though. When I download the source code, it is hard to know which example goes with which chapter (i.e., 12 chapters, but 10 examples). I am sure that I could figure it out by reading really carefully, but is there a way to put that type of info in your Readme.txt files for each example? Thanks for considering this.

  29. Structed |

    Hi Cal!

    You should think about fixing that encoding issues on your front page… It doesn’t look that good for you if you are a web developer and have such issues (although they might be caused by wordpress…)

    BUT: Thank you alot for your book - makes starting into ZF quite easy.

    Cheers,
    Structed

  30. Mike |

    I’m breezing right through this book. Great work, Cal!
    So I’ve completed Chapter 9 and written my “own” web service (great!). Now, I’m a little confused as how I need to access it. I’m trying to test it the simplest way I know how: through the browser. However, when I try to access http://localhost/api/fetchTop, I get an error saying fetchtop isn’t an action.
    Ideas?

  31. Mike |

    OK, so I just learned something (the answer to my own question above):

    If you have a camel-case Action function, you need to deliniate the URL with hyphens, like so: http://localhost/api/fetch-top. This will execute fetchTopAction in class ApiController.

    I’m sure everyone already knew this, however, I was a bit cloudy on what the rules around the naming conventions were (as I just started with ZF using this book).

    Thanks!
    -Mike

  32. Cal Evans |

    @Mike,

    You beat me to it. :) I was going to suggest fetch-top. I believe that was a changed introduced in 1.5 or 1.6.

    Glad you found it.

    =C=

  33. Mike |

    Text errata: Page 163, 2nd paragraph, line 5:
    […]neither IE not FireFox know[…]
    should read:
    […]neither IE or Firefox know[…]

    1. Neither…not… was presumable meant to read neither..nor. However, as that is a double negative, most likely correct language would be neither…or.
    2. FireFox is actually branded with a lowercase second ‘f’.

  34. Mike |

    If anyone has some initial issues getting the rewrite mechanism to work with ZendCore, you will need to make the following adjustments, which weren’t discussed in the preparation section (most likely because the book assumed a XAMP environment, not ZendCore):

    1. Uncomment line “LoadModule rewrite_module modules/mod_rewrite.so”.
    2. In set “AllowOverride All”.

  35. Mike |

    Regarding previous comment: looks like it swallowed my markup in item 2. Should be:
    2. <Directory “[root dir here]”> set “AllowOverride All”.

  36. Mike |

    Text errata: page 168, paragraph 1, line 1:
    […]find and dandy[…]

    Should most likely read:
    […]fine and dandy[…]

  37. Mike |

    Code errata: page 171, codeblock 1, line 6:
    […]class Zend_Controller_Request_Cli extends […]

    Should read:
    […]class Cal_Controller_Request_Cli extends […]

    (or did I miss something there?)

    Thanks,
    Mike

  38. Mike |

    Ran into a snag in Chapter 12: ZF Party Tricks. It appears that ZF 1.7.1 has a differing version of the Zend_Controller_Router_Abstract class, as I can no longer extend it the way the example code describes it. Whenever I try to run it now, it returns the following error:

    C:\Documents and Settings\Mike\Zend\workspaces\DefaultWorkspace\core\processes>php clearCache.php -c Process -a test -v -all
    PHP Fatal error: Class Cal_Controller_Router contains 1 abstract method and mus
    t therefore be declared abstract or implement the remaining methods (Zend_Contro
    ller_Router_Interface::assemble) in C:\Documents and Settings\Mike\Zend\workspaces\DefaultWorkspace\core\lib\Cal\Controller\Request\Router.php on line 4

    Any thoughts on how to get around this?
    Thanks!
    Mike

  39. Mike |

    Regarding my text errata for page 163, I seem to have confused myself a bit. The correct phrase is “neither […] nor […]” as written in the book. My apologies, I’m not trying to nitpick, rather provide hopefully helpful feedback.

    Happy Holidays!
    Mike

  40. Mark |

    Why are Erratas such as that posted by ’ssin’ on April 18th, 2008 posted here but not listed in the Errata section?

    Just updating the source code is not really helping as the book shows you line by line what the code is doing, but when the code doesn’t work it contradicts any explanation.

    Otherwise I like the book!

  41. Nan |

    I possibly want to buy this book, and so I looked at the same chapter you give away. But I want to know if I will understand the basic Zend set up and use, so I think the chapter you give away should be one of the basic chapters. I actually didn’t understand any of the sample chapter, including what the page is even going to do.

  42. Steve L |

    I keep hitting a problem with the sample code for Chapter 3 - The Controller.

    I can load the index.phtml page but when I submit a URL, I get a 404,
    The requested URL /index/extract was not found on this server.

    Since I was able to get the first application running in Chapter 2, I don’t think it is a basic configuration problem. I am running Linux/Apache and have set up the httpd.conf as follows….

    ServerName secondApp.com
    ServerAlias http://www.secondApp.com
    DocumentRoot /var/www/html/secondApp

    I then edited /etc/hosts to point secondapp.com to 127.0.0.1

    I have double checked the bootstrap file, the only things that have changed are the lib_paths…
    $lib_paths[] = “/var/www/lib”;
    $lib_paths[] = “/var/www/secondApp”;

    $frontController->setControllerDirectory(’/var/www/secondApp/controllers/’);

    I have checked and rechecked the file permissions on the server, apache can see all the files.

    Here is the error message from /var/log/httpd/error_log

    [Tue Mar 10 11:39:22 2009] [error] [client 127.0.0.1] File does not exist: /var/www/html/secondApp/index, referer: http://secondapp.com/

    And you can see that index does not exist (index.php does) in directory.

    # ls /var/www/html/secondApp/
    total 16
    drwxrwxr-x 2 apache webdev 4096 Mar 10 11:14 ./
    drwxr-xr-x 9 apache webdev 4096 Mar 9 13:52 ../
    -rw-rw-r– 1 apache webdev 805 Mar 9 12:00 index.php

    I would greatly appreciate any suggestions.

    Steve

  43. Steve L |

    In my last post, a few items were filtered out when I posted. The Apache httpd.conf file should have shown the VirtualHost delimiters around the ServerName, ServerAlias, and DocumentRoot.

  44. Steve L |

    Thanks to Rob Allen’s page, I think I resolved my issue.

    http://akrabat.com/zend-framework-tutorial/

    –snip–
    If you are getting 404 errors when going to any page other than the home page, please make sure that you have set AllowOverride to All in your Apache configuration.
    –snip–

    Setting AllowOverride All in my httpd.conf and restarting the server stops the 404 messages. It had been set to None with my Linux distro’s default config.

    Good Luck to All…
    Steve

  45. Mathew |

    Chapter 2 Page 24
    “If everything worked properly up to this point, you will see something that looks like Figure 3.1″.

    When I did this, I got a “500 Internal Server Error”.

    The opening tag “<?” of the first line “” of “index.phtml” seemed to be causing the problem (for whatever reason).

    To get around this, I used php to echo the line as follows: “<?php echo “”;?>” and the page now loads OK.

    Does anyone know why this was happening?

  46. ChrisTrahey |

    For any getting parse errors on “line 1″ of one of the view scripts, the solution is to disable “short open tags”.

    The reason is that your parser will see
    <?xml version=”"
    and try to compile it like:
    <?php
    xml version=”"

  47. zahir |

    Hi Cal,

    I would like to buy a PDF version of the book. But I would like to know first which version of framework have you described here. I think its 1.10 may be.

Leave a Reply