當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Zend_View::clearVars方法代碼示例

本文整理匯總了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;
 }
開發者ID:rukzuk,項目名稱:rukzuk,代碼行數:18,代碼來源:MailBuilder.php

示例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;
 }
開發者ID:BGCX261,項目名稱:zoocms-svn-to-git,代碼行數:53,代碼來源:Content.php

示例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));
 }
開發者ID:jsnshrmn,項目名稱:Suma,代碼行數:14,代碼來源:ViewTest.php

示例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);
 }
開發者ID:matthimatiker,項目名稱:molcomponents,代碼行數:13,代碼來源:Factory.php


注:本文中的Zend_View::clearVars方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。