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


PHP ComponentCollection::trigger方法代碼示例

本文整理匯總了PHP中ComponentCollection::trigger方法的典型用法代碼示例。如果您正苦於以下問題:PHP ComponentCollection::trigger方法的具體用法?PHP ComponentCollection::trigger怎麽用?PHP ComponentCollection::trigger使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在ComponentCollection的用法示例。


在下文中一共展示了ComponentCollection::trigger方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: render

 /**
  * Instantiates the correct view class, hands it its data, and uses it to render the view output.
  *
  * @param string $view View to use for rendering
  * @param string $layout Layout to use
  * @return CakeResponse A response object containing the rendered view.
  * @link http://book.cakephp.org/2.0/en/controllers.html#Controller::render
  */
 public function render($view = null, $layout = null)
 {
     $this->beforeRender();
     $this->Components->trigger('beforeRender', array(&$this));
     $viewClass = $this->viewClass;
     if ($this->viewClass != 'View') {
         list($plugin, $viewClass) = pluginSplit($viewClass, true);
         $viewClass = $viewClass . 'View';
         App::uses($viewClass, $plugin . 'View');
     }
     $View = new $viewClass($this);
     if (!empty($this->uses)) {
         foreach ($this->uses as $model) {
             list($plugin, $className) = pluginSplit($model);
             $this->request->params['models'][$className] = compact('plugin', 'className');
         }
     }
     if (!empty($this->modelClass) && ($this->uses === false || $this->uses === array())) {
         $this->request->params['models'][$this->modelClass] = array('plugin' => $this->plugin, 'className' => $this->modelClass);
     }
     $models = ClassRegistry::keys();
     foreach ($models as $currentModel) {
         $currentObject = ClassRegistry::getObject($currentModel);
         if (is_a($currentObject, 'Model')) {
             $className = get_class($currentObject);
             list($plugin) = pluginSplit(App::location($className));
             $this->request->params['models'][$currentObject->alias] = compact('plugin', 'className');
             $View->validationErrors[$currentObject->alias] =& $currentObject->validationErrors;
         }
     }
     $this->autoRender = false;
     $this->View = $View;
     $this->response->body($View->render($view, $layout));
     return $this->response;
 }
開發者ID:kevguy,項目名稱:Auth-Website,代碼行數:43,代碼來源:Controller.php


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