Easy PHP Websites with the Zend Framework (2011)
by W.J. Gilmore
Note that square brackets []are used where <> are normally used. This is because blogger doesn't like HTML in posts.
======================================================================
Chapter 2, page 34
If short tags are disabled in your php.ini file, you'll have to use:
[title][?php echo $this-]pageTitle; ?][/title]
instead of
[title][?= $this-]pageTitle; ?][/title]
Short tags not really bad as rumored ... advocated by author.
======================================================================
Chapter 3, page 45
Under "Managing Views" the author writes:
"When a controller action is invoked, the Zend Framework's default behavior is to look for an appropriately named action to return as a response."
He may have meant "...appropriately named view ..."
If having trouble overriding the default action view, try:
$this-]_helper-]viewRenderer('alternate');
======================================================================
Chapter 3, page 46
Unresolved issue -- overriding the default action view path doesn't seem to work.
My intent was to override the view associated with About/contact and use the view associated with Index/index. From the contactAction() within the AboutController:
$this-]view-]setScriptPath('/application/views/scripts/index/');
$this-]view-]render('index.phtml');
which throws an application error. So does:
$this-]view-]setScriptPath('/application/views/scripts/index/');
$this-]_helper-]viewRenderer('index');
Hard to follow ZF documentation on this issue:
Config issue ... not really something you'd need to do. Action -> view.
======================================================================
GameNomad companion website INSTALL.txt, Step #2
Revisions from the author --
After running the following command;
$ git clone git://github.com/doctrine/doctrine2.git doctrine2-orm
Enter the directory (which should be doctrine2-orm) and execute the
following command:
$ git submodule update --init (that is two dashes before the init)
Looks like Doctrine2 requires the submodules to be manually installed,
they probably did this for efficiency's sake, when I wrote that
chapter I was using a bleeding-edge Doctrine2 release so maybe they
were stuffing everything in for simplicity's sake. I'll get the
install document updated, thanks for pointing this out.
Note -- The Doctrine website now includes these instructions on their website.
Continue with the remaining instructions in Step #2.
======================================================================
GameNomad companion website INSTALL.txt, Step #6
If you're getting PHP errors when pointing your browser to the
GameNomad companion website, try using the absolute paths for the
Doctrine configurations. For example:
resources.entityManager.connection.entities =
"/usr/local/zend/apache2/www/gamenomad/application/models"
resources.entityManager.connection.proxies.location =
"/usr/local/zend/apache2/www/gamenomad/application/models/Proxies"
======================================================================
GameNomad companion website INSTALL.txt, Step #7
The script "seed.php" fails. Issue still not resolved.
Does "seed.php" use any of the configs/application.ini configs?
Partial resolution provided in follow-up post.
======================================================================
Chapter 5, page 67
Try getPost() instead of getValue():
public function loginAction() {
$form = new Application_Model_FormLogin();
if ($this-]getRequest()-]isPost()) {
$email = $this-]_request-]getPost('email');
$pswd = $this-]_request-]getPost('pswd');
echo "
Your e-mail is {$email}, and password is {$pswd}
";}
$this-]view-]form = $form;
}
Look at gamenomad code! see wjgilmore/gamenomad.com
getPost() shouldn't work with filters!
wont work: $email = $this-]_request-]getValue('email');
will work: $email = $form-]getValue('email'); specific to using form filters.
will validate, not filter.
======================================================================
Chapter 6, page 88 and 89
Instead of the code that starts at the bottom of the page, try:
zf configure db-adapter \
'adapter=PDO_MYSQL&host=%&username=root&password=good98&dbname=tables' production
0 comments:
Post a Comment