當前位置: 首頁>>代碼示例>>PHP>>正文


PHP News::findAll方法代碼示例

本文整理匯總了PHP中app\models\News::findAll方法的典型用法代碼示例。如果您正苦於以下問題:PHP News::findAll方法的具體用法?PHP News::findAll怎麽用?PHP News::findAll使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在app\models\News的用法示例。


在下文中一共展示了News::findAll方法的14個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: actionAll

 public function actionAll()
 {
     $items = News::findAll();
     if ($items == false) {
         header("HTTP/1.0 404 Not Found");
         throw new E404Exception('News cannot be found');
     }
     $view = new View();
     $view->assign('items', $items);
     $template = 'news/news_view.php';
     $view->display($template);
 }
開發者ID:Alexandr1987,項目名稱:barricade,代碼行數:12,代碼來源:NewsController.php

示例2: actionIndex

 protected function actionIndex()
 {
     $news = \App\Models\News::findAll();
     $dataTable = new \App\AdminDataTable($news, [function ($article) {
         return $article->id;
     }, function ($article) {
         return $article->title;
     }, function ($article) {
         return $article->author->name;
     }]);
     $this->view->news = $dataTable->render();
     $this->view->display(__DIR__ . '/../templates/admin/table.php');
 }
開發者ID:webmaza75,項目名稱:php2,代碼行數:13,代碼來源:Admin.php

示例3: actionAllShow

 public function actionAllShow()
 {
     $this->view->items = Model::findAll();
     $this->view->display('all');
     //Пример работы шаблонизатора Twig
     /*$items = Model::findAll();
       $isAdmin = App::isAdmin();
       $login = $_SESSION['user']['login'];
       echo $this->twig->render('all.html', array (
           'items' => $items,
           'login' => $login,
           'isAdmin' => $isAdmin
       ));*/
 }
開發者ID:semho,項目名稱:customer-DB,代碼行數:14,代碼來源:News.php

示例4: actionIndex

 protected function actionIndex()
 {
     $lastNews = \App\Models\News::findAll();
     $dataTable = new AdminDataTable($lastNews, function ($m) {
         return $m->id;
     }, function ($m) {
         return $m->date;
     }, function ($m) {
         return $m->title;
     }, function ($m) {
         return $m->author->name;
     });
     $this->view->display('indexTable.php', ['data' => $dataTable->render()]);
 }
開發者ID:scorp7mix,項目名稱:pr-of-it.php2,代碼行數:14,代碼來源:News.php

示例5:

<?php

use App\Models\News;
require __DIR__ . '/autoload.php';
$news = News::findAll();
include __DIR__ . '/App/Views/Admin/all.php';
開發者ID:Alex4S,項目名稱:PHP2_STUDY,代碼行數:6,代碼來源:index.php

示例6: News

<?php

use App\Models\User;
use App\Models\News;
use App\Config;
include 'autoload.php';
include 'Assets/backend/head.php';
if (!empty($_POST)) {
    $news = new News();
    $news->title = $_POST['title'];
    $news->text = $_POST['text'];
    $news->date = '2016-02-19';
    $news->save();
}
$articles = News::findAll();
foreach ($articles as $news) {
    echo '<tr>';
    echo '<td>' . $news->id . '</td>';
    echo '<td>' . $news->title . '</td>';
    echo '<td>' . $news->text . '</td>';
    echo '<td><a href="edit.php?id=' . $news->id . '">Редактировать</a></td>';
}
include 'Assets/backend/bottom.php';
開發者ID:vasa00739,項目名稱:php.local,代碼行數:23,代碼來源:admin.php

示例7: actionAll

 /**
  * Метод вывода всех новостей
  *
  */
 protected function actionAll()
 {
     $this->view->title = 'Урок 4 - Новости';
     $this->view->news = NewsModel::findAll();
     $this->view->display(__DIR__ . '/../templates/news/index.html');
 }
開發者ID:eropkinvitaliy,項目名稱:PHP-2-profit,代碼行數:10,代碼來源:News.php

示例8: actionAll

 /**
  * Метод вывода всех новостей
  *
  */
 protected function actionAll()
 {
     $news = NewsModel::findAll();
     $this->view->render('/admin/all.html', ['news' => $news]);
 }
開發者ID:eropkinvitaliy,項目名稱:PHP-2-profit,代碼行數:9,代碼來源:Admin.php

示例9: actionAll

 /**
  * Метод вывода всех новостей
  *
  */
 protected function actionAll()
 {
     $this->view->news = NewsModel::findAll();
     $this->view->display(__DIR__ . '/../templates/admin/index.html');
 }
開發者ID:eropkinvitaliy,項目名稱:PHP-2-profit,代碼行數:9,代碼來源:Admin.php

示例10: actionAll

 /**
  * Метод вывода всех новостей
  *
  */
 protected function actionAll()
 {
     $news = NewsModel::findAll();
     $this->view->render('/news/index.html', ['news' => $news, 'resource' => \PHP_Timer::resourceUsage()]);
 }
開發者ID:eropkinvitaliy,項目名稱:PHP-2-profit,代碼行數:9,代碼來源:News.php

示例11: actionIndex

 /**
  * Действие для вывода всех новостей
  */
 protected function actionIndex()
 {
     $this->view->news = \App\Models\News::findAll();
     $this->view->display(__DIR__ . '/../Templates/News/All.php');
 }
開發者ID:RayManOff,項目名稱:my-blog,代碼行數:8,代碼來源:News.php

示例12:

<?php

/**
 * Тестирование реализации интерфейса ArrayAccess,
 * для его корректной работы пришлось отключить
 * закомментировать использование трейта MagicFunc!!!
 */
require_once __DIR__ . '/../../autoload.php';
$view = new \App\View();
$view->title = 'ура';
$view->green = 'зеленый';
$view->news = \App\Models\News::findAll();
foreach ($view as $prop => $value) {
    echo $prop . ' = ' . $value . '<br>';
}
echo '<hr>';
開發者ID:webmaza75,項目名稱:php2,代碼行數:16,代碼來源:array_access.php

示例13: actionIndex

 protected function actionIndex()
 {
     $this->view->title .= ' Список новостей.';
     $this->view->articles = \App\Models\News::findAll();
     $this->view->display(__DIR__ . '/../Views/admin_main.php');
 }
開發者ID:bigazzzz,項目名稱:php2-lessons,代碼行數:6,代碼來源:Admin.php

示例14: actionIndex

 protected function actionIndex()
 {
     $this->view->title = 'Мой крутой сайт!';
     $this->view->news = \App\Models\News::findAll();
     $this->view->display(__DIR__ . '/../templates/index.php');
 }
開發者ID:AnnaOzer,項目名稱:pro-php2,代碼行數:6,代碼來源:News.php


注:本文中的app\models\News::findAll方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。