本文整理汇总了PHP中Zend_View类的典型用法代码示例。如果您正苦于以下问题:PHP Zend_View类的具体用法?PHP Zend_View怎么用?PHP Zend_View使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Zend_View类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _initView
/**
* Init view
*/
protected function _initView()
{
$theme = 'default-ui';
if (isset($_COOKIE["theme"])) {
$theme = $_COOKIE["theme"];
} elseif (isset($this->config->app->theme)) {
$theme = $this->config->app->theme;
}
define('THEME', $theme);
// Initialize view
$_options = $this->getOptions();
$view = new Zend_View();
$view->doctype('HTML5');
$view->headMeta()
->appendHttpEquiv('Content-Type', 'text/html; charset=UTF-8')
->appendHttpEquiv('X-UA-Compatible', 'IE=Edge');
$view->headTitle($_options['app']['name'])->setSeparator(' - ');
// Add it to the ViewRenderer
$viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper(
'ViewRenderer'
);
$viewRenderer->setView($view);
// Return it, so that it can be stored by the bootstrap
return $view;
}
示例2: 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();
}
}
示例3: _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();
}
示例4: testGravatar
/**
* @covers Robo47_View_Helper_Gravatar::Gravatar
* @dataProvider gravatarProvider
*/
public function testGravatar($email, $size, $rating, $default, $ssl, $separator, $params)
{
$view = new Zend_View();
$view->setEncoding('utf-8');
$view->Doctype(Zend_View_Helper_Doctype::XHTML1_STRICT);
$service = new Robo47_Service_Gravatar();
$helper = new Robo47_View_Helper_Gravatar($service);
$helper->setView($view);
$gravatarImageTag = $helper->Gravatar($email, $size, $rating, $default, $ssl, $separator, $params);
$src = $service->getUri($email, $size, $rating, $default, $ssl, $separator);
$alt = 'Gravatar ' . $service->getGravatarHash($email);
libxml_use_internal_errors(true);
$dom = new DOMDocument();
$dom->loadHTML('<html><head><title></title></head><body>' . $gravatarImageTag . '</body></html>');
libxml_use_internal_errors(false);
$nodes = $dom->getElementsByTagName('img');
$this->assertEquals(1, $nodes->length);
$image = $nodes->item(0);
$this->assertTrue($image->hasAttribute('src'), 'Image has no attribute "href"');
$this->assertTrue($image->hasAttribute('alt'), 'Image has no alt');
foreach ($params as $param => $value) {
$this->assertTrue($image->hasAttribute($param), 'Image has no attribute "' . $param . '"');
$this->assertEquals($value, $image->getAttribute($param), 'Image attribute "' . $param . '" has wrong value');
}
$srcAttribute = $image->getAttribute('src');
$this->assertEquals($src, $srcAttribute, 'Image attribute "src" has wrong value');
if (isset($params['alt'])) {
$altAttribute = $image->getAttribute('alt');
$this->assertEquals($params['alt'], $altAttribute, 'Image attribute "alt" has wrong value');
} else {
$altAttribute = $image->getAttribute('alt');
$this->assertEquals($alt, $altAttribute, 'Image attribute "alt" has wrong value');
}
}
示例5: createView
/**
* Creates a pre-configured view object.
*
* @return Zend_View
*/
protected function createView()
{
$view = new Zend_View();
$urlHelper = new Mol_Test_View_Helper_Url();
$view->registerHelper($urlHelper, 'url');
return $view;
}
示例6: news
public function news()
{
$view = new Zend_View();
$base = $view->baseurl();
try {
$query = "SELECT * FROM page where menu like '12' ORDER BY id DESC limit 0,4";
$stml = $this->db->prepare($query);
$stml->execute();
while ($result = $stml->fetch(PDO::FETCH_ASSOC)) {
$id = $result['id'];
$title = $result['title'];
$url = khongdau($title);
$date = $result['date'];
$menu = $result['menu'];
$images = $result['images'];
$link = "{$base}/trang/{$url}-{$id}-{$menu}.html";
echo "<div class='clear_10'></div>";
echo "<a href=\"{$url}/pages/tin-tuc-12.html\" title=\"{$ten}\"> <img src=\"{$base}/Upload/{$images}\"> </a>";
echo "<a href=\"{$link}\"> <h5> {$title} </h5></a>";
echo "<span>{$date} <span>";
echo "<div class='clear'></div>";
echo "<div class='clear_border'></div>";
}
} catch (Exception $exc) {
echo $exc->getTraceAsString();
}
}
示例7: _initView
protected function _initView()
{
$view = new Zend_View();
$view->headTitle('test test');
$view->docType('XHTML1_STRICT');
Zend_Layout::startMvc(array('layoutPath' => APPLICATION_PATH . '/layouts'));
}
示例8: indexAction
public function indexAction()
{
$view = new Zend_View();
$view->headScript()->appendFile('/js/jquery.mousewheel-3.0.6.pack.js');
$view->headScript()->appendFile('/js/jquery.fancybox.js?v=2.1.0');
$view->headLink()->appendStylesheet('/js/jquery.fancybox.css?v=2.1.0');
$company = new Default_Model_CompanyMapper();
$rowPerPage = $this->_getParam('rowperpage', 20);
$currentPage = 1;
$page = $this->_getParam('page', 1);
if (!empty($page)) {
$currentPage = $page;
}
$txtSearch = $this->_getParam('txtSearch', '');
$opt = $this->_getParam('opt', 'company_name');
$sort = $this->_getParam('sort', 'created_date');
$order = $this->_getParam('order', 'DESC');
$where = '';
if ($txtSearch) {
$where = $opt . ' like "%' . $txtSearch . '%"';
}
$order1 = ' ORDER BY ' . $sort . ' ' . $order;
$rows = $company->getListCompany($where, $order1);
$paginator = Zend_Paginator::factory($rows);
$paginator->setItemCountPerPage($rowPerPage);
$paginator->setCurrentPageNumber($currentPage);
$this->view->paginator = $paginator;
$this->view->txtSearch = $txtSearch;
$this->view->opt = $opt;
$this->view->sort = $sort;
$this->view->order = $order;
}
示例9: 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;
}
示例10: _initView
protected function _initView()
{
//INICIAR PLUGIN PARA CADA MODULE TER SEU LAYOUT
$view = new Zend_View();
$view->setEncoding('UTF-8');
Zend_Layout::startMvc(array('layoutPath' => APPLICATION_PATH . '/modules/default/layouts/scripts', 'layout' => 'default', 'pluginClass' => 'App_Plugins_SetLayout'));
}
示例11: postDispatch
public function postDispatch()
{
$response = $this->getResponse();
$view = new Zend_View();
$view->setBasePath(APPLICATION_PATH . '/views');
$response->append('footer', $view->render('footer.phtml'));
}
示例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: indexAction
public function indexAction()
{
$view = new Zend_View();
$view->headScript()->appendFile('/js/jquery.mousewheel-3.0.6.pack.js');
$view->headScript()->appendFile('/js/jquery.fancybox.js?v=2.1.0');
$view->headLink()->appendStylesheet('/js/jquery.fancybox.css?v=2.1.0');
$txtSearch = $this->_getParam('txtSearch', '');
$where = '';
if ($txtSearch) {
$where = ' name like "%' . $txtSearch . '%"';
}
$rowPerPage = $this->_getParam('rowperpage', 20);
$currentPage = 1;
$page = $this->_getParam('page', 1);
if (!empty($page)) {
$currentPage = $page;
}
$clients = new Default_Model_ClientsMapper();
$listClients = $clients->getListClient($where);
$paginator = Zend_Paginator::factory($listClients);
$paginator->setItemCountPerPage($rowPerPage);
$paginator->setCurrentPageNumber($currentPage);
$this->view->paginator = $paginator;
$this->view->txtSearch = $txtSearch;
}
示例14: _initView
protected function _initView()
{
$this->bootstrap(array('request'));
// Initialize view
$view = new Zend_View();
$view->setEncoding('UTF-8');
$view->doctype('XHTML1_STRICT');
$view->headTitle()->setSeparator(' » ');
// Save the base URL
$view->baseUrl = $this->getResource('request')->getBaseUrl();
// Add it to the ViewRenderer
$viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper('ViewRenderer');
$viewRenderer->setView($view);
// Add some stylesheet
$view->headLink()->appendStylesheet($view->baseUrl . '/css/default.css');
// Set user info
/*
$session = $this->getResource('session');
$view->userLoggedIn = $session->logged_in;
$view->userInfo = $session->user;
*/
$view->addHelperPath(APPLICATION_PATH . '/views/helpers', 'SimpleCal_View_Helper_');
Zend_Dojo::enableView($view);
// Return it, so that it can be stored by the bootstrap
return $view;
}
示例15: 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();
}