Things to Remember

Saturday, 10 July 2010

1st Zend practice

ok after installing in applications/xampp/xamppfiles/lib/php/zend, and settting alias for zf.sh in .bash_profile, and php include path for applications/xampp/xamppfiles/lib/php/zend/library/bin ....

i did this:


cd Sites/
zf create project zendtest
cd zendtest/

oh yeah i set up my vhosts for the public folder in the zendtest folder that was created.
http://zendtest then took me to the default page
all good so far

we're dealing with books here so i created a book controller (class)

zf create controller book

this put BookController.php in the controllers folder,
and a views/scripts/book folder was made
in that folder was index.phtml, which only contained placeholder html

i could now goto http://zendtest/book

in the view/scripts folder, the folders are controllers, and the files correspond to the controllers ACTIONS(methods).

BookController.php also contained:
public function indexAction()
{
// action body
}

the index part of indexAction maps to the view index.phtml

ok now lets add more actions, we want to do things with books;

zf create action add book
zf create action edit book
zf create action delete book

now in the views/scripts/book folder we have more .phtml files, namely add edit, delete.

and in our controller file, we have more actions:

public function addAction()
{
// action body
}

public function editAction()
{
// action body
}

public function deleteAction()
{
// action body
}

these map to the following urls
http://zendtest/book/add
http://zendtest/book/edit
http://zendtest/book/delete

join me next time lmao when ill find out more grooviness!

Labels: