Welcome, Guest. Please login or register.
Did you miss your activation email?
Nov. 01, 2014, 09:07:11 AM
56628 Posts in 12745 Topics by 19623 Members
Latest Member: aGenRa12
News:
 
The PRADO Community » Prado v3.x » General Discussion » HOWTO: PRADO and Zend Framework « previous next »
Pages: [1] Print
Author Topic: HOWTO: PRADO and Zend Framework  (Read 1514 times)
thoth
Junior Member
**

Karma: 1
Offline Offline

Posts: 6



View Profile
« on: Nov. 19, 2008, 09:21:16 AM »

Hello!

PRADO and Zend Framework can coexist seamlessly in the same web application.
There are two approaches to accomplish such task:
 
  • Embed Zend Framework into PRADO, making every web application using the framework accessible to Zend Framework.
  • Embed Zend Framework into a specific web application, rendering Zend Framework accessible only to the application in question.

Embedding Zend into PRADO

Copy class root folder 'Zend' to PRADO root folder and edit prado.php

./framework/prado.php
Code:

<?php

...

/**
 * Includes TApplication class file
 */
require_once(dirname(__FILE__).'/TApplication.php');

/**
 * Includes TShellApplication class file
 */
require_once(dirname(__FILE__).'/TShellApplication.php');

/**
 * Setup Zend Framework Environment
 */

Prado::using("System.*");
Prado::setPathOfAlias('Zend'PRADO_DIR '/Zend');

?>



Embedding Zend Framework in an Application

Copy class root folder 'Zend' to 'protected' folder in your web application

application.xml
Code:

  <paths>
  <using namespace="System.*" />
  <alias id="Zend" path="Zend" />
  </paths>


Example usage of Zend Framework

SomeEmailProcedure.php
Code:

<?php

Prado
::using('Zend.Mail');
Prado::using('Zend.Mail.Transport.Smtp');

$mail = new Zend_Mail();
$mail->addTo('someone@invalid.tld');
$mail->setFrom('someone@invalid.tld');
$mail->setSubject('PRADO + ZF = ;D');
$mail->setBodyText('Zend Framework seamlessly integrated into Prado');

try {
    
$mail->send(new Zend_Mail_Transport_Smtp('localhost'));
} catch (
Zend_Mail_Protocol_Exception $e) {
    die(
'Destination email does not exist.');
}

?>



The suggested placement of Zend folder is the way I use it, but you can change it to suit your needs.
I hope this helps someone.

Greetings from Portugal

Logged
eirikhm
PRADO v3.x Developer
Platinum Member
*****

Karma: 30
Offline Offline

Posts: 845



View Profile WWW
« Reply #1 on: Nov. 19, 2008, 11:44:23 AM »

Nice sample. Perhaps you should put it up in the cookbook on the wiki page
Logged

Pages: [1] Print 
« previous next »
Jump to: