本文整理汇总了PHP中News::getAllNews方法的典型用法代码示例。如果您正苦于以下问题:PHP News::getAllNews方法的具体用法?PHP News::getAllNews怎么用?PHP News::getAllNews使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类News
的用法示例。
在下文中一共展示了News::getAllNews方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: NewsSelector
<?php
$url = Url::getCurrentUrl();
new NewsSelector();
//force class loading for constants
/******************************\
LOAD NEWS
\******************************/
$selected = $url->hasQueryVar('select') ? $url->getQueryVar('select') : NEWSSELECTOR_ALL;
$selector = new NewsSelector($selected, $_SESSION[MODE_H]);
if (Url::getCurrentUrl()->hasQueryVar('showPrepared')) {
$selector->setPreparedShown(true);
}
$newsList = News::getAllNews($selector);
usort($newsList, array('News', 'timestampSorter'));
/******************************\
BUILD VIEWS ACCESS
\******************************/
$viewMap = array(NEWSSELECTOR_ALL => "Dernières news", NEWSSELECTOR_RELEASES => "Sorties", NEWSSELECTOR_TEAM => "Infos team", NEWSSELECTOR_PARTNERS => "Partenaires", NEWSSELECTOR_DB0COMPANY => "db0 company", NEWSSELECTOR_MISC => "Bonus");
$viewsLinks = new SimpleBlockComponent();
foreach ($viewMap as $id => $name) {
$url->setQueryVar('select', empty($id) ? null : $id, true);
$viewsLinks->addComponent(new Link(new Url($url), $name));
}
$views = new HeaderComponent();
$views->setClass("views");
$rssUrl = buildRssUrlIfAvailable();
$title = new Title(null, 2);
$title->addComponent(new RssLink($rssUrl));
$title->addComponent("Vues");
$views->addComponent($title);
示例2: dirname
<?php
define('ROOT', dirname(__FILE__));
require_once ROOT . '/includes/DB_Connection.php';
require_once ROOT . '/includes/News.php';
include "./pages/header.php";
if (isset($_GET['news_id'])) {
$action = $_GET['news_id'];
$news = new News();
$news->getOneNew($action);
} elseif (isset($_GET['author_id'])) {
$action = $_GET['author_id'];
$news = new News();
$news->getNewsOneAuthor($action);
} else {
$news = new News();
$news->getAllNews();
}
include "./pages/footer.php";
示例3: News
<html>
<head>
<meta charset="utf-8">
</head>
<body>
<?php
//include __DIR__."/DataBase.php";
require __DIR__ . "/Article.php";
$news = new News();
$news->deleteArticle(8);
//$sql->insert('Привет', 'Как дела?');
//$sql->update(5,'Заголвок новтси','Как ошибки делаются');
$posts = $news->getAllNews();
foreach ($posts as $key) {
echo $key['id'] . ' ' . $key['title'] . ' ' . $key['text'] . '<br>';
}
var_dump($posts);
?>
</body>
</html>
示例4: array
$json["status"] = 0;
$json["statusInfo"] = "fail";
$json["error"] = "parameter missing";
} else {
$usr->makeofflineguest($_REQUEST["guestid"]);
$json["status"] = 1;
$json["statusInfo"] = "success";
}
}
if ($_REQUEST["operation"] == "news") {
if (!isset($_REQUEST["role"]) || !isset($_REQUEST["appid"]) || !isset($_REQUEST["imported_appid"]) || !isset($_REQUEST["offset"]) || !isset($_REQUEST["userid"])) {
$json["status"] = 0;
$json["statusInfo"] = "fail";
$json["error"] = "parameter missing";
} else {
$data = $news->getAllNews($_REQUEST["role"], $_REQUEST["appid"], $_REQUEST["offset"], $_REQUEST["userid"], $_REQUEST["imported_appid"]);
//$data= $rs; //$news->getRowReal();
$timezone = date_default_timezone_get();
if ($data) {
$usr->updateUnreadNewsCount($_REQUEST["userid"], $_REQUEST["role"]);
$json["status"] = 1;
$json["statusInfo"] = "success";
$json["news"] = $data;
$json["timezone"] = $timezone;
} else {
$json["status"] = 1;
$json["statusInfo"] = "success";
$json["news"] = array();
$json["timezone"] = $timezone;
//$json["error"]="nodata";
}
示例5: getNews
public static function getNews($id)
{
foreach (News::getAllNews() as $news) {
if ($news->getId() == $id) {
return $news;
} else {
continue;
}
}
throw new Exception("{$id} is not a valid news ID");
}