ZF ZendFramework In Case Of
URL to this page: bit.ly/s_zf
api v1.11
manual v1.11
coding style
zf db table
with tb twitter-bootstrap
https://github.com/Emagister/zend-form-decorators-bootstrap
A Quick Starter for ZF New Guys #
I was following: “Getting Started with Zend Framework”, By Rob Allen, v1.7.7
ENV: i am using ZendFramework-1.11.0.zip instead of zend-server, in Linux.
// ln /etc/php5/zendFramework_1.11.10/bin/zf.sh /usr/bin/zf ; //got some problems, so:
ps: if apt-get install zend-framework-bin (1.10) , then default lib will be /usr/share/php/libzend-framework-php
( ref: /usr/share/zend-framework /usr/share/doc/libzend-framework-php)
#apt-get install phpunit
//this is for php-pear. may need to fix: /etc/apt/sources.list and ‘apt-get update’ before install unit.
modify /etc/php5/apache2/php.ini, change: (maybe also: /etc/php5/cli/php.ini):
**include_path = ".:/etc/php5/zendFramework_1.11.10/library:/usr/share/php:/usr/share/php/PHPUnit"**
check:
#zf show version
ok, so:
#zf create project projectName
#apt-get install php5-sqlite
The following is a sample VHOST you might want to consider for your project.
<VirtualHost *:80> ServerName quickstart.local DocumentRoot /now/codes/zend_framework/quickstart/public SetEnv APPLICATION_ENV "development" <Directory /now/codes/zend_framework/quickstart/public> DirectoryIndex index.php AllowOverride All Order allow,deny Allow from all </Directory> </VirtualHost>
now, u should be able to access the web.
see /var/log/apache2/error.log for detail if get 500 error.
e.g., if no rewrite is available:
#ln -s /etc/apache2/mods-available/rewrite.load /etc/apache2/mods-enabled/
default configuration is placed in application/configs/application.ini
#zf enable layout
// Something More: #
3 sentences about : zf configure db-adapter blala….
http://framework.zend.com/manual/1.11/en/zend.tool.usage.cli.html
Create the script as scripts/load.sqlite.php
! flesh out: scripts/load.sqlite.php
php scripts/load.sqlite.php –withdata
#zf create db-table Guestbook guestbook
#zf create model GuestbookMapper
! flesh out: models/GuestbookMapper.php
Now it’s time to create our model class.
#zf create model Guestbook
! flesh out: models/Guestbook.php class: Application_Model_GuestbookMapper
Lastly, to connect these elements all together, lets create a guestbook controller
#zf create controller Guestbook
(this will create view, too.)
! flesh out: controllers/GuestbookController.php
! flesh out: views/scripts/guestbook/index.phtml
#zf create form Guestbook
! flesh out: application/forms/Guestbook.php
#zf create action sign Guestbook //format : zf create action actionName ControllerName
this will create a signAction() method in our controller, as well as the appropriate view script.
! flesh out: action: sign in Controller: Guestbook