本文整理汇总了PHP中Category_Model::limit方法的典型用法代码示例。如果您正苦于以下问题:PHP Category_Model::limit方法的具体用法?PHP Category_Model::limit怎么用?PHP Category_Model::limit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Category_Model
的用法示例。
在下文中一共展示了Category_Model::limit方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: page
public function page($page_no = 1)
{
$items_per_page = 2;
$cat_id = 2;
$offset = ($page_no - 1) * $items_per_page;
$limit = $items_per_page;
$category = new Category_Model($cat_id);
//$category = ORM::factory('category')->with('catagories_description')->find($cat_id); //without the lazy loading
echo $category->name . '<br>';
echo $category->catagories_description->description . '<br>';
$catalog_list = $category->limit($limit, $offset)->products;
//$catalog_list = $category->limit($limit, $offset)->like('products.name', 'ca')->products;
//$catalog_list = $category->limit($limit, $offset)->where('product_id >', 1)->products;
$catalog_total = $category->count_last_query();
echo 'this category has ' . $catalog_total . ' related products';
foreach ($catalog_list as $p) {
echo $p->name . '<br>';
echo $p->products_description->description . '<br>';
print_r($p->attributes);
}
$pagination = new Pagination(array('uri_segment' => 'page', 'total_items' => $catalog_total, 'items_per_page' => $items_per_page, 'style' => 'classic', 'auto_hide' => TRUE));
echo $pagination->render();
$profile = new Profiler();
}