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


PHP Template_Controller::before方法代碼示例

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


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

示例1: before

 /**
  * Overload to reroute to view-action if a gallery is defined
  */
 public function before()
 {
     parent::before();
     if ($galleri = $this->request->param('galleri')) {
         $this->request->action = 'view';
     }
 }
開發者ID:Burgestrand,項目名稱:Anglarna-Stockholm,代碼行數:10,代碼來源:galleri.php

示例2: before

 public function before()
 {
     parent::before();
     $param = $this->request->param('forum');
     $forum = Model_Forum::factory($param)->load();
     try {
         if (!$forum->loaded()) {
             throw new Kohana_Exception('Forumet :forum existerar inte.', array(':forum' => $param));
         }
         $roles = $forum->roles->as_array(NULL, 'name');
         if (!$this->auth->has_roles($roles)) {
             throw new Kohana_Exception('Du måste vara inloggad för att ha tillgång till forum/:forum.', array(':forum' => $forum->name));
         }
     } catch (Kohana_Exception $e) {
         $this->message_add($e->getMessage(), 'error');
         $this->request->redirect('forum');
     }
     // Save forum for later use
     $this->_forum = $forum;
     // REST-thingy
     switch (Request::$method) {
         case 'POST':
             $this->request->action = 'create';
             break;
         case 'DELETE':
             $this->request->action = 'delete';
             break;
     }
 }
開發者ID:Burgestrand,項目名稱:Anglarna-Stockholm,代碼行數:29,代碼來源:forum.php

示例3: before

 public function before()
 {
     // For nagivation active link show
     $path = $this->request->param('path');
     $this->request->controller = substr($path, strpos($path, '/'));
     parent::before();
 }
開發者ID:Burgestrand,項目名稱:Anglarna-Stockholm,代碼行數:7,代碼來源:static.php

示例4: before

 public function before()
 {
     parent::before();
     // Automatically set request status
     $status = $this->request->param('status', 500);
     if (isset(Request::$messages[$status])) {
         $this->request->status = $status;
     }
     // View variables
     $this->template->title = __(Request::$messages[$this->request->status]);
 }
開發者ID:Burgestrand,項目名稱:Anglarna-Stockholm,代碼行數:11,代碼來源:error.php


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