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


PHP Version::find_all方法代碼示例

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


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

示例1: show

 public function show()
 {
     try {
         $user = User::find_by_username($_GET['username']);
         switch ($this->format) {
             case 'xml':
                 $this->header('Content-Type: text/xml', 200);
                 $this->package = Package::find('first', array('conditions' => array('user_id' => $user->id, 'name' => $_GET['package_name'])));
                 echo $this->package->to_xml();
                 $this->layout = false;
                 $this->has_rendered = true;
                 break;
             case 'json':
                 $this->header('Content-type: application/json', 200);
                 $this->package = Package::find('first', array('conditions' => array('user_id' => $user->id, 'name' => $_GET['package_name'])));
                 echo $this->package->to_json();
                 $this->layout = false;
                 $this->has_rendered = true;
                 break;
             default:
                 if ($this->is_logged_in()) {
                     $this->login_user();
                 }
                 try {
                     $this->set_default_side_bar();
                     $this->package = Package::find('first', array('conditions' => array('user_id' => $user->id, 'name' => $_GET['package_name'])));
                     $this->title = $this->package->name;
                     Nimble::Set_title($this->title);
                     $this->versions = Version::find_all(array('limit' => '0,5', 'conditions' => array('package_id' => $this->package->id), 'order' => 'version DESC'));
                     $this->total_versions = $this->package->count('versions');
                     $this->version = $this->package->current_version();
                     if ($this->version !== false) {
                         $this->data = unserialize($this->version->meta);
                     }
                 } catch (NimbleRecordNotFound $e) {
                     Nimble::flash('notice', 'The package you were looking for does not exsist');
                     $this->redirect_to('/');
                 }
                 break;
         }
     } catch (NimbleRecordNotFound $e) {
         Nimble::flash('notice', 'The package you were looking for does not exsist');
         $this->redirect_to('/');
     }
 }
開發者ID:scottdavis,項目名稱:pearfarm_channel_server,代碼行數:45,代碼來源:package_controller.php

示例2: show

 public function show()
 {
     if ($this->is_logged_in()) {
         $this->login_user();
     }
     try {
         $this->set_default_side_bar();
         $user = User::find_by_username($_GET['username']);
         $this->package = Package::find('first', array('conditions' => array('user_id' => $user->id, 'name' => $_GET['package_name'])));
         $this->title = $this->package->name;
         Nimble::Set_title($this->title);
         $this->versions = Version::find_all(array('limit' => '0,5', 'conditions' => array('package_id' => $this->package->id), 'order' => 'version DESC'));
         $this->total_versions = $this->package->count('versions');
         $this->version = $this->package->current_version();
         if ($this->version !== false) {
             $this->data = unserialize($this->version->meta);
         }
     } catch (NimbleRecordNotFound $e) {
         Nimble::flash('notice', 'The package you were looking for does not exsist');
         $this->redirect_to('/');
     }
 }
開發者ID:xetorthio,項目名稱:pearfarm_channel_server,代碼行數:22,代碼來源:package_controller.php


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