当前位置: 首页>>代码示例>>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;未经允许,请勿转载。