本文整理汇总了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);
}
示例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');
}
示例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
));*/
}
示例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()]);
}
示例5:
<?php
use App\Models\News;
require __DIR__ . '/autoload.php';
$news = News::findAll();
include __DIR__ . '/App/Views/Admin/all.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';
示例7: actionAll
/**
* Метод вывода всех новостей
*
*/
protected function actionAll()
{
$this->view->title = 'Урок 4 - Новости';
$this->view->news = NewsModel::findAll();
$this->view->display(__DIR__ . '/../templates/news/index.html');
}
示例8: actionAll
/**
* Метод вывода всех новостей
*
*/
protected function actionAll()
{
$news = NewsModel::findAll();
$this->view->render('/admin/all.html', ['news' => $news]);
}
示例9: actionAll
/**
* Метод вывода всех новостей
*
*/
protected function actionAll()
{
$this->view->news = NewsModel::findAll();
$this->view->display(__DIR__ . '/../templates/admin/index.html');
}
示例10: actionAll
/**
* Метод вывода всех новостей
*
*/
protected function actionAll()
{
$news = NewsModel::findAll();
$this->view->render('/news/index.html', ['news' => $news, 'resource' => \PHP_Timer::resourceUsage()]);
}
示例11: actionIndex
/**
* Действие для вывода всех новостей
*/
protected function actionIndex()
{
$this->view->news = \App\Models\News::findAll();
$this->view->display(__DIR__ . '/../Templates/News/All.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>';
示例13: actionIndex
protected function actionIndex()
{
$this->view->title .= ' Список новостей.';
$this->view->articles = \App\Models\News::findAll();
$this->view->display(__DIR__ . '/../Views/admin_main.php');
}
示例14: actionIndex
protected function actionIndex()
{
$this->view->title = 'Мой крутой сайт!';
$this->view->news = \App\Models\News::findAll();
$this->view->display(__DIR__ . '/../templates/index.php');
}