本文整理匯總了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('/');
}
}
示例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('/');
}
}