本文整理汇总了PHP中Zend_View::render方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_View::render方法的具体用法?PHP Zend_View::render怎么用?PHP Zend_View::render使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_View
的用法示例。
在下文中一共展示了Zend_View::render方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: envia
/**
* Método Responsável pelo Envio
* @return boolean
* @throws Zend_Mail_Exception
*/
public function envia()
{
try {
//$oConteudoEmail = $this->oViewEmail->setScriptPath ($this->sTemplate);
//if (isset($this->oDadosView->oArquivoAnexo)) {
//
// $this->oEmail->createAttachment ($this->getArquivoAnexo());
//}
$sConteudoEmail = $this->oViewEmail->render(APPLICATION_PATH . '/../public/templates/' . $this->getTemplate());
if ($this->getConfiguracaoEmail()->formato == 'html') {
$this->oEmail->setBodyHtml($sConteudoEmail);
} else {
$this->oEmail->setBodyText($sConteudoEmail);
}
$this->oEmail->setFrom($this->oViewEmail->sEmailOrigem, $this->oViewEmail->sNomeOrigem);
$this->oEmail->setReplyTo($this->oViewEmail->sEmailOrigem, $this->oViewEmail->sNomeOrigem);
$this->oEmail->addTo($this->oViewEmail->sEmailDestino, $this->oViewEmail->sNomeDestino);
$this->oEmail->setSubject($this->oViewEmail->sAssunto);
$this->oEmail->send($this->getMetodoTransporte());
$oRetorno->mensage = self::SUCESSO_ENVIO;
$oRetorno->status = true;
return $oRetorno;
} catch (Zend_Mail_Exception $oErro) {
throw new Zend_Mail_Exception($oErro);
}
}
示例2: _sendNewCommentEmail
/**
* Send email notification to moderators when a new comment is posted
*
* @todo move logic to model / library class
*
* @param HumanHelp_Model_Comment $comment
* @param HumanHelp_Model_Page $page
*/
public function _sendNewCommentEmail(HumanHelp_Model_Comment $comment, HumanHelp_Model_Page $page)
{
$config = Zend_Registry::get('config');
$emailTemplate = new Zend_View();
$emailTemplate->setScriptPath(APPLICATION_PATH . '/views/emails');
$emailTemplate->addHelperPath(APPLICATION_PATH . '/views/helpers', 'HumanHelp_View_Helper_');
$emailTemplate->setEncoding('UTF-8');
$emailTemplate->comment = $comment;
$emailTemplate->page = $page;
$emailTemplate->baseUrl = 'http://' . $_SERVER['HTTP_HOST'] . $this->view->baseUrl;
$bodyHtml = $emailTemplate->render('newComment.phtml');
$bodyText = $emailTemplate->render('newComment.ptxt');
$mail = new Zend_Mail();
$mail->setType(Zend_Mime::MULTIPART_ALTERNATIVE)->setBodyHtml($bodyHtml, 'UTF-8')->setBodyText($bodyText, 'UTF-8')->setSubject("New comment on '{$page->getTitle()}' in '{$page->getBook()->getTitle()}'")->setFrom($config->fromAddress, $config->fromName);
if (is_object($config->notifyComments)) {
foreach ($config->notifyComments->toArray() as $rcpt) {
$mail->addTo($rcpt);
}
} else {
$mail->addTo($config->notifyComments);
}
if ($config->smtpServer) {
$transport = new Zend_Mail_Transport_Smtp($config->smtpServer, $config->smtpOptions->toArray());
} else {
$transport = new Zend_Mail_Transport_Sendmail();
}
$mail->send($transport);
}
示例3: renderMenu
protected function renderMenu()
{
$container = new Zend_Navigation(VAR_menu);
$this->view->assign('menu', $container);
$this->view->assign('module', $this->_getParam('module'));
Zend_Layout::getMvcInstance()->assign('navbar', $this->view->render('navbar.phtml'));
}
示例4: send
/**
* Send email
*
* @param Zend_Mail $mail
* @return Zend_Mail
*/
public function send(Zend_Mail $mail = null)
{
if ($mail) {
$mail = clone $mail;
} else {
$mail = new Zend_Mail();
}
$this->bodyHtml = $this->_view->render($this->_viewScriptName);
$mail = $this->populate($mail);
return $mail->send();
}
示例5: send
/**
* load the template and send the message
*
* @param string $recipient
* @param array $from
* @param string $subject
* @param string $template
* @param array $data
* @param string $cc
* @return bool
*/
public function send($recipient, $from = array(), $subject, $message, $cc = false)
{
$config = Zend_Registry::get('config');
$this->_view->addScriptPath($config->filepath->emailTemplates);
$this->_view->emailBody = $message;
$this->_mail->setBodyHtml($this->_view->render('template.phtml'));
$this->_mail->setFrom($from[0], $from[1]);
$this->_mail->addTo($recipient);
if ($cc) {
$this->_mail->addCc($cc);
}
$this->_mail->setSubject($subject);
return $this->_mail->send($this->_transport);
}
示例6: dispatch
public function dispatch($p_params = null, $p_cols = null, $p_options = null)
{
$req = $this->getRequest();
if (!$this->_hasDataMap) {
$this->setDataMap();
}
$this->_isDispatched = true;
if ($req->getParam('format') == 'json') {
$this->dispatchData($p_params, $p_cols);
return false;
}
$this->dispatchMedatata($p_params, $p_options);
return $this->_outputObject->render($this->viewPath);
}
示例7: fromTemplate
/**
* Set the e-mail's body from a template
*
* @param string $tempalte
* @param array $params
* @return Geves_Mail
*/
public function fromTemplate($template, array $params)
{
$view = new Zend_View();
$view->setScriptPath($this->_templateDir);
$view->assign($params);
if ($this->_layout) {
$this->_layout->content = $view->render($template . '.phtml');
$html = $this->_layout->render();
} else {
$html = $view->render($template . '.phtml');
}
$this->setBodyHtml($html);
$this->setBodyText(strip_tags($html));
return $this;
}
示例8: exceptionAction
/**
* Test Function for exceptionAction
*
* @return void
*/
public function exceptionAction()
{
echo "In exception action\n";
$view = new Zend_View();
$view->addBasePath(dirname(dirname(__FILE__)) . '/views');
$view->render('ob.phtml');
}
示例9: indexAction
public function indexAction()
{
$form = new Application_Form_FaleConoscoForm();
$this->view->form = $form;
$params = $this->_request->getParams();
if ($this->_request->isPost() && $form->isValid($params)) {
try {
$vista = Services::get('vista_rest');
$vista->getAuthEmail();
$smtpData = $vista->getResult();
$config = array('auth' => 'login', 'username' => $smtpData['user'], 'password' => $smtpData['pass'], 'port' => $smtpData['port']);
$transport = new Zend_Mail_Transport_Smtp($smtpData['smtp'], $config);
Zend_Mail::setDefaultTransport($transport);
$html = new Zend_View();
$html->setScriptPath(APPLICATION_PATH . '/views/scripts/fale-conosco/');
$html->data = $params;
$emailBody = $html->render('email-body.phtml');
$mail = new Zend_Mail();
$mail->setBodyHtml($emailBody);
$mail->setFrom('atendimento@esselence.com.br', $params['nome']);
$mail->addTo('atendimento@esselence.com.br', 'Esselence');
$mail->setSubject("Contato pelo Site {$params['nome']}");
$mail->send();
$this->view->success = true;
} catch (Exception $e) {
print_r($e->getMessage());
exit;
}
}
}
示例10: sendEmail
public function sendEmail($template, $to, $subject, $params = array())
{
try {
$config = array('auth' => 'Login', 'port' => $this->_bootstrap_options['mail']['port'], 'ssl' => 'ssl', 'username' => $this->_bootstrap_options['mail']['username'], 'password' => $this->_bootstrap_options['mail']['password']);
$tr = new Zend_Mail_Transport_Smtp($this->_bootstrap_options['mail']['server'], $config);
Zend_Mail::setDefaultTransport($tr);
$mail = new Zend_Mail('UTF-8');
$layout = new Zend_Layout();
$layout->setLayoutPath($this->_bootstrap_options['mail']['layout']);
$layout->setLayout('email');
$view = $layout->getView();
$view->domain_url = $this->_bootstrap_options['site']['domainurl'];
$view = new Zend_View();
$view->params = $params;
$view->setScriptPath($this->_bootstrap_options['mail']['view_script']);
$layout->content = $view->render($template . '.phtml');
$content = $layout->render();
$mail->setBodyText(preg_replace('/<[^>]+>/', '', $content));
$mail->setBodyHtml($content);
$mail->setFrom($this->_bootstrap_options['mail']['from'], $this->_bootstrap_options['mail']['from_name']);
$mail->addTo($to);
$mail->setSubject($subject);
$mail->send();
} catch (Exception $e) {
// 这里要完善
}
return true;
}
示例11: render
public function render($datas)
{
$this->_scriptName = $datas->scriptName;
# html mail
// needed: email, passwd, scriptname
$file = APPLICATION_PATH . '/configs/langs/' . $datas->lang . '/emails.ini';
$texts = new Zend_Config_Ini($file, $this->_scriptName);
$view = new Zend_View();
$view->setScriptPath($this->_config->mail->scriptsPath);
$view->setHelperPath($this->_config->mail->helpersPath);
// switch sur la lang pour header
switch ($datas->lang) {
case 'befl':
case 'befr':
case 'nl':
$view->top = 'top_challenge.jpg';
break;
default:
$view->top = 'top.jpg';
break;
}
$view->texts = $texts;
$view->assign((array) $datas->view);
$view->webhost = $this->_config->site->webhost;
$view->tplname = $this->_scriptName;
// on gere le setFrom ici car localisé
$this->setFrom($this->_config->mail->addressFrom, $texts->labelFrom);
$this->_document = $view->render($this->_scriptName . '.phtml');
$this->setSubject(utf8_decode($texts->subject));
$this->setBodyHtml($this->_document, 'utf-8');
$this->addTo($datas->view->email);
$this->send();
}
示例12: postDispatch
public function postDispatch()
{
$response = $this->getResponse();
$view = new Zend_View();
$view->setBasePath(APPLICATION_PATH . '/views');
$response->append('footer', $view->render('footer.phtml'));
}
示例13: registerAction
public function registerAction()
{
$request = $this->getRequest();
$form = new Form_User_Registration();
if ($request->isPost()) {
if ($form->isValid($request->getPost())) {
$model = new Model_User($form->getValues());
$user_id = $model->save();
$model->setId($user_id);
$globalSession = Zend_Registry::get('dlo.session');
$globalSession->user = $model;
//Zend_Loader::loadClass('Zend_View');
$view = new Zend_View();
$view->activationLink = "http://DrivingLessonOnline.com/user/verify-email/id/" . $model->getId() . "/guid/" . hash('sha1', $model->getSalt() . $model->getId() . $model->getPassword()) . "/";
$view->setBasePath(APPLICATION_PATH . "/views/");
$mailBodyHtml = $view->render('Templates/Account-Activation-Email.phtml');
//send email verification email before user can start using their account.
$mail = new Zend_Mail();
$mail->setBodyHtml($mailBodyHtml);
$mail->setFrom('no.reply@DrivingLessonOnline.com', 'Registration');
$mail->addTo($model->getEmail(), $model->getDisplayName());
$mail->setSubject($model->getDisplayName() . ' activiate your account for Driving Lesson Online.com');
$mail->send();
//thank user and inform to check their email to enable their account.
$this->_redirect('/user/registered');
}
}
$this->view->form = $form;
}
示例14: postAction
public function postAction()
{
$email = $this->_request->getParam('email');
$response = $this->_helper->response();
if (Kebab_Validation_Email::isValid($email)) {
// Create user object
$user = Doctrine_Core::getTable('Model_Entity_User')->findOneBy('email', $email);
$password = Kebab_Security::createPassword();
if ($user !== false) {
$user->password = md5($password);
$user->save();
$configParam = Zend_Registry::get('config')->kebab->mail;
$smtpServer = $configParam->smtpServer;
$config = $configParam->config->toArray();
// Mail phtml
$view = new Zend_View();
$view->setScriptPath(APPLICATION_PATH . '/views/mails/');
$view->assign('password', $password);
$transport = new Zend_Mail_Transport_Smtp($smtpServer, $config);
$mail = new Zend_Mail('UTF-8');
$mail->setFrom($configParam->from, 'Kebab Project');
$mail->addTo($user->email, $user->fullName);
$mail->setSubject('Reset Password');
$mail->setBodyHtml($view->render('forgot-password.phtml'));
$mail->send($transport);
$response->setSuccess(true)->getResponse();
} else {
$response->addNotification(Kebab_Notification::ERR, 'There isn\'t user with this email')->getResponse();
}
} else {
$response->addError('email', 'Invalid email format')->getResponse();
}
}
示例15: dispatchLoopShutdown
/**
* dispatchLoop shutdown plugin
* get action view and wrap it with site template view
* @author Xinghao Yu <xinghao@airarena.net>
*/
public function dispatchLoopShutdown()
{
//logfire('postdispatch','happened');
//chech whether using site template
if ($this->_renderLayout > 0) {
//logfire('isbackend', $this->_renderLayout);
//get frontcontroller, request and response objects
$frontController = Zend_Controller_Front::getInstance();
$request = $frontController->getRequest();
// If it is error page, we do not want wrap it with extra header and footer.
if (!strcasecmp($request->getControllerName(), 'Error')) {
return;
}
$response = $frontController->getResponse();
//get action view and stored it in actionTempate var
$body = $response->getBody();
//logfire('body',$body);
$this->_view->actionTemplate = $body;
//get template script
$layoutScript = $this->getTemplateScript();
//logfire('script ', $layoutScript);
//$this->_view->actionTemplate = '/'.$request->getControllerName().'/'.$request->getActionName().'.phtml';
$content = $this->_view->render($layoutScript);
$response->setBody($content);
}
}