當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。