本文整理汇总了PHP中News::find_all方法的典型用法代码示例。如果您正苦于以下问题:PHP News::find_all方法的具体用法?PHP News::find_all怎么用?PHP News::find_all使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类News
的用法示例。
在下文中一共展示了News::find_all方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1:
<!--**************** NEWS AND EVENTS SECTION ******************-->
<?php
$newsItems = News::find_all();
?>
<div class="col-md-3 content-fix">
<div class="content-fix-scroll" style="width: 337px;">
<div class="content-fix-wrap">
<div class="content-fix-inner" style="width: 305px;">
<h2 class="content-sub-heading">NEWS AND EVENTS</h2>
<ul>
<?php
foreach ($newsItems as $news) {
echo '<li><a href="' . $news->url . '">' . $news->title . '</a></li>';
}
?>
</ul>
</div>
</div>
</div>
</div>
<!--**************** END OF NEWS AND EVENTS SECTION ******************-->
示例2: news
public function news($reload = false)
{
if ($reload or !$this->news_cache) {
$id = mysql_real_escape_string($this->id);
$this->news_cache = News::find_all("news.user_id = '{$id}'");
}
return $this->news_cache;
}
示例3: ob_start
<?php
require_once 'init.php';
$script = Script::find_by_code('forums');
$script->start();
ob_start();
$time = date("H:i:s");
echo "[{$time}] News Posts\r\n\r\n";
$newsPosts = News::find_all("news.published = true AND news.publish_at <= NOW() and news.ipb_id IS NULL");
foreach ($newsPosts as $news) {
$response = $news->forumSync();
var_dump($response);
$script->addlog("Posting on forums for [{$news}] {$news->title}");
echo " * {$news->title}\r\n";
}
$script = Script::find_by_code('forums');
$output = ob_get_clean();
$script->finish($output);