本文整理汇总了PHP中Zend_View::setScriptPath方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_View::setScriptPath方法的具体用法?PHP Zend_View::setScriptPath怎么用?PHP Zend_View::setScriptPath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_View
的用法示例。
在下文中一共展示了Zend_View::setScriptPath方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: prepare
/**
* Pripravi data a dalsi promenne
*
* @param array $data Data na vyplneni do sablony emailu
* @return Model_Mail
*/
public function prepare($data)
{
$this->_view = new Zend_View();
$this->_view->setScriptPath(APP_PATH . '/modules/mybase/views/scripts/emails/');
$this->_mail = new Zend_Mail('utf-8');
$this->_data = $data;
return $this;
}
示例2:
function __construct($template)
{
$this->_mailer = new Zend_Mail('koi8-r');
$this->_view = new Zend_View();
$this->_template = $template;
$this->_view->setScriptPath(APPLICATION_PATH . '/views/scripts/email');
$config = Bootstrap::get('config');
$this->_mailer->addCc($config["mail"]["kadavr"]);
$this->_mailer->addCc($config["mail"]["cc"]);
}
示例3: getView
/**
* Get view
*
* @return Zend_View
*/
protected function getView()
{
if (!isset(self::$renderView)) {
//init view
self::$renderView = new Zend_View();
self::$renderView->setScriptPath(APPLICATION_PATH . "/modules/teaser/views/scripts/templates/");
self::$renderView->addHelperPath(APPLICATION_PATH . "/modules/teaser/views/helpers/", "Teaser_View_Helper");
$mvcView = Zend_Layout::getMvcInstance()->getView();
if (isset($mvcView->theme)) {
self::$renderView->addScriptPath(APPLICATION_PATH . '/../themes/' . $mvcView->theme . '/views/teaser/templates/');
}
}
return self::$renderView;
}
示例4: sendMail
/**
* Send an email
* @param String $emailTo
* @param String $emailFrom
* @param String $emailSubject
* @param String $emailData
* @param String $tpl
* @return Zend_Session_Namespace
* @author Reda Menhouch, reda@fornetmaroc.com
*/
public function sendMail($toMail, $toName, $mailSubject, $emailData, $tpl, $fromMail = false, $fromName = false, $sujetMail = "", $h1Mail = "")
{
$config = new Zend_Config_Ini(APPLICATION_PATH . '/configs/application.ini', APPLICATION_ENV);
$mailConfig = array('auth' => $config->mail->transport->auth, 'username' => $config->mail->transport->username, 'password' => $config->mail->transport->password, 'ssl' => $config->mail->transport->ssl, 'port' => $config->mail->transport->port);
//var_dump($mailConfig); die;
$transport = new Zend_Mail_Transport_Smtp($config->mail->transport->host, $mailConfig);
$html = new Zend_View();
$html->setScriptPath(APPLICATION_PATH . '/modules/frontend/views/emails/');
foreach ($emailData as $key => $value) {
$html->assign($key, $value);
}
$html->assign('sujetMail', $sujetMail);
$html->assign('h1Mail', $h1Mail);
$mailSubjectTail = "";
//$mailSubjectTail=" - [" . $toMail . "]";
$html->assign('site', $config->site->url);
$bodyText = $html->render($tpl . '.phtml');
$fromMail = $fromMail === false ? $config->mail->defaultFrom->email : $fromMail;
$fromName = $fromName === false ? $config->mail->defaultFrom->name : $fromName;
$mail = new Zend_Mail('utf-8');
$mail->setBodyHtml($bodyText, 'utf-8');
$mail->setFrom($fromMail, $fromName);
$mail->addTo($toMail, $toName);
$mail->setSubject($config->mail->defaultSubject->prefix . $mailSubject . $mailSubjectTail);
$mail->send($transport);
}
示例5: recoveryPasswordCliente
public function recoveryPasswordCliente($email)
{
try {
if ($this->_modelCliente->verificarEmail($email) == true) {
try {
$where = $this->_modelCliente->getAdapter()->quoteInto('email = ?', $email);
$user = $this->_modelCliente->fetchAll($where);
$html = new Zend_View();
$html->setScriptPath(APPLICATION_PATH . '/assets/templates/');
// enviando variaveis para a view
$html->assign('nome', $user[0]['nome']);
$html->assign('email', $user[0]['email']);
$html->assign('senha', $user[0]['pass']);
// criando objeto email
$mail = new Zend_Mail('utf-8');
// render view
$bodyText = $html->render('esqueciasenha.phtml');
// configurar envio
$mail->addTo($user[0]['email']);
$mail->setSubject('Esqueci a senha ');
$mail->setFrom('eduardo@inndeia.com', 'Instag');
$mail->setBodyHtml($bodyText);
$mail->send();
return true;
} catch (Exception $e) {
throw $e;
}
} else {
return false;
}
} catch (Exception $e) {
throw $e;
}
}
示例6: contatoAction
public function contatoAction()
{
if ($this->_request->isPost()) {
$html = new Zend_View();
$html->setScriptPath(APPLICATION_PATH . '/modules/default/layouts/scripts/');
$title = 'Contato | Instag';
$to = 'eduardo@inndeia.com';
$cc = 'renato@inndeia.com';
$html->assign('title', $title);
$html->assign('nome', $this->_request->getPost('nome'));
$html->assign('email', $this->_request->getPost('email'));
$html->assign('assunto', $this->_request->getPost('assunto'));
$html->assign('mensagem', $this->_request->getPost('mensagem'));
$mail = new Zend_Mail('utf-8');
$bodyText = $html->render('contato.phtml');
$config = array('ssl' => 'tls', 'port' => 587, 'auth' => 'login', 'username' => 'nao-responder@instag.com.br', 'password' => 'Inndeia123');
$transport = new Zend_Mail_Transport_Smtp('127.0.0.1', $config);
$mail->addTo($to);
$mail->addCc($cc);
$mail->setSubject($title);
$mail->setFrom($this->_request->getPost('email'), $this->_request->getPost('name'));
$mail->setBodyHtml($bodyText);
$send = $mail->send($transport);
if ($send) {
$this->_helper->flashMessenger->addMessage('Sua mensagem foi enviada com sucesso, em breve entraremos em contato.');
} else {
$this->_helper->flashMessenger->addMessage('Falha no envio, tente novamente!');
}
$this->_redirect('/index');
}
}
示例7: _initView
protected function _initView()
{
$theme = 'default';
$templatePath = APPLICATION_PATH . '/../public/themes/' . $theme . '/templates';
Zend_Registry::set('user_date_format', 'm-d-Y');
Zend_Registry::set('calendar_date_format', 'mm-dd-yy');
Zend_Registry::set('db_date_format', 'Y-m-d');
Zend_Registry::set('perpage', 10);
Zend_Registry::set('menu', 'home');
Zend_Registry::set('eventid', '');
$dir_name = $_SERVER['DOCUMENT_ROOT'] . rtrim(str_replace(basename($_SERVER['SCRIPT_NAME']), '', $_SERVER['SCRIPT_NAME']), '/');
Zend_Registry::set('acess_file_path', $dir_name . SEPARATOR . "application" . SEPARATOR . "modules" . SEPARATOR . "default" . SEPARATOR . "plugins" . SEPARATOR . "AccessControl.php");
Zend_Registry::set('siteconstant_file_path', $dir_name . SEPARATOR . "public" . SEPARATOR . "site_constants.php");
Zend_Registry::set('emailconstant_file_path', $dir_name . SEPARATOR . "public" . SEPARATOR . "email_constants.php");
Zend_Registry::set('emptab_file_path', $dir_name . SEPARATOR . "public" . SEPARATOR . "emptabconfigure.php");
Zend_Registry::set('emailconfig_file_path', $dir_name . SEPARATOR . "public" . SEPARATOR . "mail_settings_constants.php");
Zend_Registry::set('application_file_path', $dir_name . SEPARATOR . "public" . SEPARATOR . "application_constants.php");
$date = new Zend_Date();
Zend_Registry::set('currentdate', $date->get('yyyy-MM-dd HH:mm:ss'));
Zend_Registry::set('currenttime', $date->get('HH:mm:ss'));
Zend_Registry::set('logo_url', '/public/images/landing_header.jpg');
$view = new Zend_View();
$view->setEscape('stripslashes');
$view->setBasePath($templatePath);
$view->setScriptPath(APPLICATION_PATH);
$view->addHelperPath('ZendX/JQuery/View/Helper', 'ZendX_JQuery_View_Helper');
$viewRenderer = new Zend_Controller_Action_Helper_ViewRenderer();
$viewRenderer->setView($view);
Zend_Controller_Action_HelperBroker::addHelper($viewRenderer);
return $this;
}
示例8: 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;
}
示例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: __construct
/**
* @param array $data
*/
public function __construct(array $data = array())
{
$this->_view = new Zend_View();
if (isset($data['name'])) {
$this->_viewScriptName = $data['name'];
} else {
throw new InvalidArgumentException('Script name not setted!');
}
if (isset($data['basePath'])) {
$this->_view->setBasePath($data['basePath']);
}
if (isset($data['scriptPath'])) {
$this->_view->setScriptPath($data['scriptPath']);
}
parent::__construct($data);
}
示例11: _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);
}
示例12: setTemplate
/**
* Sets and compiles E-mail templates for both plain and html
*/
public function setTemplate($template)
{
$tempPath = $this->_config->email->templatesPath;
$this->_template = $template;
$myView = new Zend_View();
$myView->setScriptPath($tempPath);
$hasContent = false;
// compile html template if available
$fileName = 'html.' . $template;
$filePath = $tempPath . '/' . $fileName;
if (is_file($filePath)) {
$this->_logger->info('Custom_Email::setTemplate(): Rendering HTML "' . $template . '" template.');
$viewHtml = clone $myView;
$this->_body_html = $this->applyTokens($viewHtml, $fileName);
$hasContent = true;
}
// compile plain text template if available
$fileName = 'plain.' . $template;
$filePath = $tempPath . '/' . $fileName;
if (is_file($filePath)) {
$this->_logger->info('Custom_Email::setTemplate(): Rendering plain text "' . $template . '" template.');
$viewPlain = clone $myView;
$this->_body_plain = $this->applyTokens($viewPlain, $fileName);
$hasContent = true;
}
if (!$hasContent) {
$this->_logger->err('Custom_Email::setTemplate(' . $template . '): Unable to find e-mail template.');
}
}
示例13: 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();
}
}
示例14: 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();
}
示例15: setUp
public function setUp()
{
$view = new Zend_View();
$base = str_replace('/', DIRECTORY_SEPARATOR, '/../_templates');
$view->setScriptPath(dirname(__FILE__) . $base);
$view->strictVars(true);
$this->view = $view;
}