本文整理汇总了PHP中Package::paginate方法的典型用法代码示例。如果您正苦于以下问题:PHP Package::paginate方法的具体用法?PHP Package::paginate怎么用?PHP Package::paginate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Package
的用法示例。
在下文中一共展示了Package::paginate方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
public function index()
{
$this->set_default_side_bar();
$this->title = 'All Packages';
Nimble::set_title($this->title);
$page = isset($_GET['page']) ? $_GET['page'] : NULL;
switch ($this->format) {
case 'xml':
$this->packages = Package::find_all();
$this->header('Content-Type: text/xml', 200);
echo $this->packages->to_xml();
$this->layout = false;
$this->has_rendered = true;
break;
case 'json':
$this->packages = Package::find_all();
$this->header('Content-type: application/json', 200);
echo $this->packages->to_json();
$this->layout = false;
$this->has_rendered = true;
break;
case 'atom':
$this->layout = false;
$this->has_rendered = true;
break;
case 'rss':
$this->layout = false;
$this->has_rendered = true;
break;
default:
$this->full = true;
$this->packages = Package::paginate(array('select' => '`packages`.*, AVG(`package_ratings`.`rating`) as rating', 'order' => 'rating DESC', 'per_page' => 20, 'page' => $page, 'joins' => 'LEFT JOIN `package_ratings` on `package_ratings`.`package_id` = `packages`.`id`', 'group' => '`packages`.id'));
break;
}
}
示例2: packages
public function packages()
{
$this->data['cycles'] = Cycle::all();
$this->data['services'] = Service::orderBy('name')->get();
$this->data['packages'] = Package::paginate(25);
return $this->layout->content = View::make('packages', $this->data);
}
示例3: index
public function index()
{
$this->set_default_side_bar();
$this->title = 'All Packages';
Nimble::set_title($this->title);
$page = isset($_GET['page']) ? $_GET['page'] : NULL;
$this->packages = Package::paginate(array('order' => 'name DESC', 'per_page' => 20, 'page' => $page));
switch ($this->format) {
case 'xml':
$this->header('Content-Type: text/xml', 200);
echo $this->packages->to_xml(array('include' => array('versions')));
$this->layout = false;
$this->has_rendered = true;
break;
case 'atom':
break;
case 'rss':
break;
}
}
示例4: simple_search
public static function simple_search($value)
{
$page = isset($_GET['page']) ? $_GET['page'] : NULL;
return Package::paginate(array('select' => '`packages`.*, AVG(`package_ratings`.`rating`) as rating', 'order' => 'rating DESC', 'per_page' => 20, 'page' => $page, 'conditions' => NimbleRecord::sanitize(array('name LIKE ?', "%{$value}%")), 'joins' => 'LEFT JOIN `package_ratings` on `package_ratings`.`package_id` = `packages`.`id`', 'group' => '`packages`.id'));
}
示例5: simple_search
public static function simple_search($value)
{
$page = isset($_GET['page']) ? $_GET['page'] : NULL;
return Package::paginate(array('order' => 'updated_at DESC', 'per_page' => 20, 'page' => $page, 'conditions' => NimbleRecord::sanitize(array('name LIKE ?', "%{$value}%"))));
}