Professional Documents
Culture Documents
Components
Environment setup Your first Zend Framework project Resources QA
What is framework ?
Toolbox
Blueprint
Skeleton
Open Source
Flexible Architecture ZF Certification Partner with
Loosely couple
Zend Components
Zend_Validate
Zend_Auth
Zend_Acl
ZEND_FORM
Zend_Session
ZEND_FEED ZEND_GDATA
Environment Setup
Requirements
1. 2. PHP 5.x Web server with mod_rewrite enabled
zf show version
Zend Framework Version: 1.11.10
Project structure
<VirtualHost *:80> ServerName local.sitename.com DocumentRoot /var/www/zf-project/public <Directory "/var/www/zf-project/public"> AllowOverride All </Directory> </VirtualHost>
Tada!
Connecting to database
resources.db.adapter = "Pdo_Mysql resources.db.params.host = HostName" resources.db.params.username = UserName" resources.db.params.password = Password" resources.db.params.dbname = DbName"
Controller
Controller
<?php
} }
Model
Model
<?php class Application_Model_Albums extends Zend_Db_Table_Abstract { protected $_name = 'albums'; public function fName() {
/* Your code goes here */
} }
Crud operation
public function addAlbum($data) { $this->insert($data); } public function updateAlbum($data, $where) { $this->update($data, $where); } public function deleteAlbum($where) { $this->delete($where); }
Web services
1. 2. 3. 4. 5. Google Amazon Flickr Yahoo More.
<ul> <?php foreach ($this->results as $result){ $photo = $result->Square; ?> <li><a href="<?php echo $photo->ClickUri ?>"> <img src="<?php echo $photo->uri ?>" alt="image"/> </a> </li> <?php } ?> </ul>
Resources
Who we are
Any Question?