当前位置: 首页>>代码示例>>PHP>>正文


PHP News::paginate方法代码示例

本文整理汇总了PHP中News::paginate方法的典型用法代码示例。如果您正苦于以下问题:PHP News::paginate方法的具体用法?PHP News::paginate怎么用?PHP News::paginate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在News的用法示例。


在下文中一共展示了News::paginate方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: index

 public function index()
 {
     $page = 1;
     if (isset($_GET['page'])) {
         $page = $_GET['page'];
     }
     $news = News::paginate("news.published = true AND news.publish_at < NOW()", "news.publish_at DESC", $page, 10);
     $this->assign("page", $news);
     if (isset($_GET['rss'])) {
         // We don't want to clear flash data
         if (isset($this->site['flash'])) {
             $_SESSION['flash'] = $this->site['flash'];
         }
         header("Content-Type: application/rss+xml");
         $this->render("news/index.rss.tpl", true);
     } else {
         $this->title = "News Archive";
         $this->render("news/index.tpl");
     }
 }
开发者ID:ItsHaden,项目名称:epicLanBootstrap,代码行数:20,代码来源:news.controller.php

示例2: news

 public function news()
 {
     $news = News::paginate(4);
     //分页显示
     return View::make('home.news')->with('news', $news);
 }
开发者ID:Konaeu,项目名称:ubicom,代码行数:6,代码来源:HomeController.php

示例3: index

 public function index()
 {
     $page = 1;
     if (isset($_GET['page'])) {
         $page = $_GET['page'];
     }
     $news = News::paginate(null, "news.publish_at DESC", $page, 20);
     $this->assign("page", $news);
     $this->title = "News";
     $this->render("news/index.tpl");
 }
开发者ID:ItsHaden,项目名称:epicLanBootstrap,代码行数:11,代码来源:news.controller.php

示例4: newsEdit

 public function newsEdit()
 {
     $news = News::paginate(10);
     return View::make('admin.news-edit')->with('news', $news);
 }
开发者ID:Konaeu,项目名称:ubicom,代码行数:5,代码来源:AdminController.php

示例5: function

    }
    return View::make('catalog', ['categories' => $categories, 'products' => $products]);
});
Route::get('/catalog/categories/{alias}', function ($alias = null) {
    $categories = Category::where('parent_id', 0)->get();
    $category = Category::where('alias', $alias)->firstOrFail();
    $products = Product::where('category_id', $category->id)->orderBy('updated_at', 'desc')->paginate(6);
    return View::make('catalog', ['categories' => $categories, 'category' => $category, 'products' => $products]);
});
Route::get('/catalog/products/{alias}', function ($alias = null) {
    $categories = Category::where('parent_id', 0)->get();
    $product = Product::where('alias', $alias)->firstOrFail();
    return View::make('product', ['categories' => $categories, 'product' => $product]);
});
Route::get('/news', function () {
    $news = News::paginate(10);
    return View::make('news', ['news' => $news]);
});
Route::match(array('get', 'post'), '/contacts', function () {
    if (Request::isMethod('post')) {
        // send email
        Mail::send('emails.contact', Input::all(), function ($message) {
            $message->from(Input::get('email'), Input::get('name'));
            $message->to('danny_kent@mail.ru')->subject('Message from bumagi.by');
        });
    }
    return View::make('contacts');
});
Route::get('cart/order', 'CartController@order');
Route::resource('cart', 'CartController', array('only' => array('index', 'store', 'destroy')));
// Confide routes
开发者ID:VerticalHorizon,项目名称:Bumagi,代码行数:31,代码来源:routes.php


注:本文中的News::paginate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。