本文整理汇总了PHP中Zend_View类的典型用法代码示例。如果您正苦于以下问题:PHP Zend_View类的具体用法?PHP Zend_View怎么用?PHP Zend_View使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Zend_View类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
开发者ID:necrogami,项目名称:phpRackMonkey,代码行数:31,代码来源:Bootstrap.php
示例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();
}
}
开发者ID:esironal,项目名称:kebab-project,代码行数:33,代码来源:ForgotPasswordController.php
示例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();
}
开发者ID:kangza,项目名称:hagtag,代码行数:33,代码来源:Bootstrap.php
示例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');
}
}
开发者ID:robo47,项目名称:robo47-components,代码行数:38,代码来源:GravatarTest.php
示例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;
}
开发者ID:matthimatiker,项目名称:molcomponents,代码行数:12,代码来源:ToTest.php
示例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();
}
}
开发者ID:lynguyetvan88,项目名称:webtuthien,代码行数:27,代码来源:Menuright.php
示例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'));
}
开发者ID:vianziro,项目名称:simuktiblogspot,代码行数:7,代码来源:Bootstrap.php
示例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;
}
开发者ID:alienpham,项目名称:resume-manager,代码行数:32,代码来源:CompanyController.php
示例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('[email protected]', '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;
}
开发者ID:Zerone,项目名称:ImJob.org,代码行数:29,代码来源:UserController.php
示例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'));
}
开发者ID:pccnf,项目名称:proj_instag,代码行数:7,代码来源:Bootstrap.php
示例11: postDispatch
public function postDispatch()
{
$response = $this->getResponse();
$view = new Zend_View();
$view->setBasePath(APPLICATION_PATH . '/views');
$response->append('footer', $view->render('footer.phtml'));
}
开发者ID:raphinou,项目名称:zend-quickstart,代码行数:7,代码来源:GuestbookController.php
示例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.');
}
}
开发者ID:relyd,项目名称:aidstream,代码行数:32,代码来源:Email.php
示例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;
}
开发者ID:alienpham,项目名称:resume-manager,代码行数:25,代码来源:ClientsController.php
示例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;
}
开发者ID:shevron,项目名称:zend-simplecal,代码行数:26,代码来源:Bootstrap.php
示例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();
}
开发者ID:AlexChien,项目名称:bbcoach,代码行数:33,代码来源:_Mailer.php
示例16: 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;
}
开发者ID:ud223,项目名称:yj,代码行数:28,代码来源:Email.php
示例17: 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');
}
开发者ID:SustainableCoastlines,项目名称:loveyourwater,代码行数:12,代码来源:ObController.php
示例18: format
public function format($event)
{
foreach ($this->_filterValues as $configName) {
$configValue = $this->_getConfigValue($this->_applicationConfiguration, $configName);
if (is_null($configValue)) {
continue;
}
if (is_array($configValue)) {
foreach ($configValue as $configValueElement) {
$event['message'] = str_replace($configValueElement, self::REPLACE_WITH, $event['message']);
if (array_key_exists('details', $event)) {
$event['details'] = str_replace($configValueElement, self::REPLACE_WITH, $event['details']);
}
}
} else {
$event['message'] = str_replace($configValue, self::REPLACE_WITH, $event['message']);
if (array_key_exists('details', $event)) {
$event['details'] = str_replace($configValue, self::REPLACE_WITH, $event['details']);
}
}
}
$view = new Zend_View();
foreach ($event as $key => $val) {
$view->__set($key, $val);
}
return $view;
}
开发者ID:newlongwhitecloudy,项目名称:OpenConext-engineblock,代码行数:27,代码来源:Mail.php
示例19: getView
public function getView()
{
$view = new Zend_View();
$view->addHelperPath(dirname(__FILE__) . '/../../../../library/Zend/View/Helper');
$view->addScriptPath(dirname(__FILE__) . '/../_files/views/');
return $view;
}
开发者ID:ThorstenSuckow,项目名称:conjoon,代码行数:7,代码来源:ViewScriptTest.php
示例20: getView
public function getView()
{
require_once 'Zend/View.php';
$view = new Zend_View();
$view->addHelperPath('ZendX/MooTools/View/Helper/', 'ZendX_MooTools_View_Helper');
return $view;
}
开发者ID:benjamingb,项目名称:ZendX_MooTools,代码行数:7,代码来源:MooToolsTest.php
注:本文中的Zend_View类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论