本文整理汇总了PHP中NewsModel::getOneByDate方法的典型用法代码示例。如果您正苦于以下问题:PHP NewsModel::getOneByDate方法的具体用法?PHP NewsModel::getOneByDate怎么用?PHP NewsModel::getOneByDate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NewsModel
的用法示例。
在下文中一共展示了NewsModel::getOneByDate方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getNews
public function getNews($date = null)
{
if ($date == null) {
$news_items = NewsModel::getAllNews();
$date = 'archive';
} else {
if (strlen($date) == 8) {
$news_items = NewsModel::getAllByDate($date);
} else {
$news_items = array(NewsModel::getOneByDate($date));
}
}
$this->addCSSFiles('news.css');
return $this->renderPage(array('title' => 'Home', 'content_title' => 'Latest Developments', 'show_intro' => false, 'news_items' => $news_items, 'news_archive_link' => false, 'date' => $date), $this->_template);
}
示例2: getNews
public function getNews($date = null)
{
global $Smarty;
if ($date == null) {
$news_items = NewsModel::getAllNews();
$date = 'archive';
} else {
if (strlen($date) == 8) {
$news_items = NewsModel::getAllByDate($date);
} else {
$news_items = array(NewsModel::getOneByDate($date));
}
}
$this->addCSSFiles('news.css');
return $this->renderPage(array('title' => $Smarty->_config[0]['vars']['newsTitle'], 'content_title' => $Smarty->_config[0]['vars']['newsContentTitle'], 'show_intro' => false, 'news_items' => $news_items, 'news_archive_link' => false, 'date' => $date), $this->_template);
}
示例3: getLatestNews
public static function getLatestNews($num = -1, $processContent = false)
{
if ($num == -1) {
return NewsModel::getAllNews($processContent);
} else {
if (!($newslist = NewsModel::getListOfNewsDates())) {
throw new ErrorException(self::NO_FILES);
}
rsort($newslist, SORT_NUMERIC);
$newslist = array_slice($newslist, 0, $num);
$news = array();
foreach ($newslist as $date) {
$news[] = NewsModel::getOneByDate($date, $processContent);
}
return $news;
}
}