本文整理汇总了PHP中Zend_View::assign方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_View::assign方法的具体用法?PHP Zend_View::assign怎么用?PHP Zend_View::assign使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_View
的用法示例。
在下文中一共展示了Zend_View::assign方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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'));
}
示例2: _initView
protected function _initView()
{
// Start initail view
$this->bootstrap('layout');
$config = $this->getOption('views');
$resources = $this->getOption('resources');
$view = new Zend_View();
if (isset($resources['layout']['layoutPath'])) {
$view->assign('layoutRootPath', $resources['layout']['layoutPath']);
}
$this->bootstrap('db');
Zend_Loader::loadClass('Ht_Utils_SystemSetting');
$sysSetting = Ht_Utils_SystemSetting::getSettings();
$view->assign('sysSetting', $sysSetting);
$view->assign('profile', Zend_Auth::getInstance()->getIdentity());
Zend_Loader::loadClass("Ht_Model_SystemSetting");
$this->setSystemLogConfiguration($sysSetting);
// use the viewrenderer to keep the code DRY
// instantiate and add the helper in one go
$viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper('ViewRenderer');
$viewRenderer->setView($view);
$viewRenderer->setViewSuffix('phtml');
// add it to the action helper broker
Zend_Controller_Action_HelperBroker::addHelper($viewRenderer);
/**
* Set inflector for Zend_Layout
*/
$inflector = new Zend_Filter_Inflector(':script.:suffix');
$inflector->addRules(array(':script' => array('Word_CamelCaseToDash', 'StringToLower'), 'suffix' => 'phtml'));
// Initialise Zend_Layout's MVC helpers
$this->getResource('layout')->setLayoutPath(realpath($resources['layout']['layoutPath']))->setView($view)->setContentKey('content')->setInflector($inflector);
return $this->getResource('layout')->getView();
}
示例3: 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);
}
示例4: 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');
}
}
示例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: send
public function send()
{
$config = Zend_Registry::get('config');
$mail = new Zend_Mail('utf-8');
$mail->setSubject('Bericht via de website van ' . $config->company->name)->setFrom($this->getEmail(), $this->getName() . ' ' . $this->getFirstName());
$view = new Zend_View();
$view->assign('contact', $this);
$view->assign('config', $config);
$view->addScriptPath(APPLICATION_PATH . '/modules/default/views/scripts');
$body = $view->render('/contact/_mailMessage.phtml');
$mail->setBodyHtml($body);
$mail->addTo($config->contact->to);
return $mail->send();
}
示例7: 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();
}
}
示例8: 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();
}
示例9: newUserCeated
public function newUserCeated($data)
{
$config = array('auth' => 'login', 'username' => 'USERNAME', 'password' => 'SENHAGMAIL', 'ssl' => 'ssl', 'port' => 465);
// Optional port number supplied
$transport = new Zend_Mail_Transport_Smtp('smtp.gmail.com', $config);
$html = new Zend_View();
$html->setScriptPath(APPLICATION_PATH . '/modules/home/views/helpers/emails');
$html->assign('name', $data['name']);
$html->assign('login', $data['login']);
$html->assign('date', date('d/m/Y H:i:s', $data['timestamp']));
$mail = new Zend_Mail("UTF-8");
$bodyText = $html->render('newUser.phtml');
$mail->setFrom(self::$fromEmail, self::$fromName);
$mail->addTo('9892345@gmail.com');
$mail->setHeaderEncoding(Zend_Mime::ENCODING_BASE64);
$mail->setSubject('Novo usuário cadastrado!');
$mail->setBodyHtml($bodyText);
$mail->send($transport);
}
示例10: render
protected function render($mailName)
{
$view = new Zend_View();
if (!$this->scriptPath) {
$this->scriptPath = ROOT_PATH . "/templates/mail";
}
$view->setBasePath($this->scriptPath);
$view->assign($this->assigns);
return $view->render($mailName . ".phtml");
}
示例11: getTemplate
public static function getTemplate($name, $vars = array())
{
$html = new Zend_View();
$html->setScriptPath(APPLICATION_PATH . '/views/emaillayouts/');
if (!empty($vars)) {
foreach ($vars as $key => $value) {
$html->assign($key, $value);
}
}
return $html->render($name);
}
示例12: sendSignUpMail
private function sendSignUpMail($user)
{
$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/');
//KBBTODO use language file
$view->assign('id', $user->id);
$view->assign('fullName', $user->fullName);
$view->assign('activationKey', $user->activationKey);
$transport = new Zend_Mail_Transport_Smtp($smtpServer, $config);
Zend_Mail::setDefaultTransport($transport);
$mail = new Zend_Mail('UTF-8');
$mail->setFrom($configParam->from, 'Kebab Project');
$mail->addTo($user->email, $user->fullName);
$mail->setSubject('Welcome to Kebab Project');
$mail->setBodyHtml($view->render('sign-up.phtml'));
$mail->send($transport);
}
示例13: Topbox
/**
*
*/
public function Topbox($bezeichner)
{
$_Model = new Application_Model_Empfehlungen();
$box = $_Model->getByBezeichner($bezeichner);
if ($box) {
$view = new Zend_View();
$view->setBasePath(APPLICATION_PATH . '/views/');
$view->assign('box', $box);
$output = $view->render('_partials/topbox.phtml');
return $output;
} else {
return '';
}
}
示例14: setViewBody
public function setViewBody($script, $params = array())
{
$layout = new Zend_Layout(array('layoutPath' => $this->_getLayoutPath()));
$layout->setLayout('email');
$view = new Zend_View();
$view->setScriptPath($this->_getViewPath() . '/email');
foreach ($params as $k => $param) {
$view->assign($k, $param);
}
$layout->content = $view->render($script . '.phtml');
//$layout->content = $msg;
$html = $layout->render();
$this->setBodyHtml($html);
}
示例15: setBodyView
public function setBodyView($script, $params = array())
{
$layout = new Zend_Layout(array('layoutPath' => APPLICATION_PATH . '/views/layouts'));
$layout->setLayout('email');
$view = new Zend_View();
$view->setScriptPath(APPLICATION_PATH . '/views/email');
foreach ($params as $key => $value) {
$view->assign($key, $value);
}
$layout->content = $view->render($script . '.phtml');
$html = $layout->render();
$this->setBodyHtml($html);
return $this;
}