本文整理汇总了PHP中Zend_View::clearVars方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_View::clearVars方法的具体用法?PHP Zend_View::clearVars怎么用?PHP Zend_View::clearVars使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_View
的用法示例。
在下文中一共展示了Zend_View::clearVars方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getFeedbackMail
/**
* Erstellt ein Feedback-Mail Objekt mit entsprechenden Daten
*
* @param \Cms\Feedback $feedback
* @return \Cms\Mail
*/
public function getFeedbackMail(\Cms\Feedback $feedback, $charset = 'utf-8')
{
$locale = new SbLocale('de');
$this->view->clearVars();
$this->view->feedback = $feedback;
$renewMail = new \Cms\Mail($charset);
$renewMail->setBodyText(utf8_encode($this->view->render($this->getTemplateFilename(__FUNCTION__, $locale))), $charset);
$renewMail->setFrom($feedback->getEmail());
$renewMail->setSubject($feedback->getSubject());
$renewMail->addTo(Registry::getConfig()->feedback->mail->adress);
return $renewMail;
}
示例2: getRenderedContent
/**
*
* @param int|array $id
* @param string $type
* @return array Rendered content items
*/
function getRenderedContent($ids, $type = 'List')
{
if (!is_array($ids)) {
$ids = array($ids);
}
foreach ($ids as $id) {
if (!is_object($id)) {
$item = $this->load($id, $type);
} else {
$item = $id;
}
$can_edit = Zoo::getService('acl')->checkItemAccess($item, 'edit');
$cacheid = "Content_node" . $type . "_" . $item->id . ($can_edit ? "_edit" : "");
try {
$cached = Zoo::getService("cache")->load($cacheid);
if ($cached) {
$content[] = $cached;
}
} catch (Zoo_Exception_Service $e) {
// Cache service unavailable, set content to empty string
$cached = false;
}
if (!$cached) {
// Render content item
if (!$this->view) {
$view = Zend_Controller_Action_HelperBroker::getStaticHelper('viewRenderer')->view;
/* @var $view Zend_View_Abstract */
// Don't clone the view until it is needed
$this->view = clone $view;
$this->view->clearVars();
}
list($module, $nodetype) = explode('_', $item->type);
$this->resetView($module, $nodetype);
$this->addLanguage($module);
$this->view->assign('item', $item);
$this->view->assign('can_edit', $can_edit);
$rendered = $this->view->render($type == "Display" ? "index" : $type);
$content[] = $rendered;
try {
Zoo::getService('cache')->save($rendered, $cacheid, array('node' . $type, 'node_' . $item->id), null);
} catch (Zoo_Exception_Service $e) {
// Cache service not available, do nothing
}
}
}
return $content;
}
示例3: testClearVars
/**
* Test that array properties are cleared following clearVars() call
*/
public function testClearVars()
{
$view = new Zend_View();
$view->foo = array();
$view->content = 'content';
$this->assertTrue(is_array($view->foo));
$this->assertEquals('content', $view->content);
$view->clearVars();
$this->assertFalse(isset($view->foo));
$this->assertFalse(isset($view->content));
}
示例4: render
/**
* Renders the provided script.
*
* @param string $script
* @param array(string=>mixed) $parameters
* @return string The rendered content.
*/
protected function render($script, array $parameters)
{
$this->view->clearVars();
$this->view->assign($parameters);
return $this->view->render($script);
}