本文整理汇总了PHP中News::getInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP News::getInstance方法的具体用法?PHP News::getInstance怎么用?PHP News::getInstance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类News
的用法示例。
在下文中一共展示了News::getInstance方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionList
public function actionList()
{
global $classSuffix;
$classSuffix = "homepage";
$this->pageTitle = "Giá xăng dầu hôm nay, gia xang dau";
$this->metaKey = "giá xăng hôm nay, gia xang, gia xang dau, giá xăng, giá xăng hiện tại, giá xăng dầu hôm nay, gia xang hom nay, giá xăng dầu, giá xăng a92";
$this->metaDesc = "Giá xăng hôm nay, cập nhật nhanh nhất bảng gia xang dau mới nhất, chính xác nhất, giá xăng hiện tại, giá xăng a92";
$params = array();
$model = Benhvienphusan::getInstance();
$modelNews = News::getInstance();
$params['giabanle'] = $model->getGiaBanLe();
$params['giathegioi'] = $model->getGiaTheGioi();
// $arrNews = $modelNews->getTinTuc($this->scopenews);
$arrNews = $modelNews->getTinTuc("*", "1,8,19,3");
$str_tintuc = "";
$k = 0;
foreach ($arrNews as $dataCart) {
if ($k == 0) {
$str_tintuc .= "<div style='overflow: hidden;'>";
}
$str_tintuc .= $modelNews->buildHtmlHome($dataCart);
if ($k == 1) {
$str_tintuc .= "</div>";
}
$k = 1 - $k;
}
$params['tintuc'] = $str_tintuc;
$this->render('list', $params);
}
示例2: write
function write()
{
global $current_user;
if (!$current_user->authorized) {
throw new Exception('Access Denied');
}
$current_user->can_throw('edit_news');
$newsItem = News::getInstance()->getByIdLoaded(Request::post('id'));
if ($newsItem) {
$this->_edit($newsItem);
} else {
$this->_new();
}
}
示例3: buildPageTitlePart
public static function buildPageTitlePart($var)
{
$x = explode(':', $var[1]);
$name = false;
if (count($x) == 3) {
list($name, $paramtype, $paramvalue) = $x;
}
if (count($x) == 2) {
list($name, $paramvalue) = $x;
$paramtype = 'raw_get';
}
if ($name) {
$val = self::parseParams($paramtype, $paramvalue);
switch ($name) {
case 'profile-nickname':
$user = Users::getByIdsLoaded(array((int) $val));
$user = isset($user[$val]) ? $user[$val] : false;
/* @var $user User */
if ($user) {
return $user->getNickName();
}
break;
case 'release-title':
$release = Releases::getInstance()->getByIdLoaded((int) $val);
/* @var $release Release */
return $release->getTitle(1);
break;
case 'news-title':
$newsitem = News::getInstance()->getByIdLoaded((int) $val);
/* @var $newsitem NewsItem */
return $newsitem->getTitle(1);
break;
case 'book-title':
$book = Books::getInstance()->getByIdLoaded((int) $val);
/* @var $book Book */
return $book->getTitle(1);
break;
case 'person-title':
$person = Persons::getInstance()->getById((int) $val);
/* @var $person Person */
return $person->getName();
break;
case 'genre-title':
return Request::pass('genre-title');
break;
case 'forum-title':
$t = Request::pass('forum-title');
if (!$t) {
$t = Database::sql2single('SELECT name FROM `term_data` WHERE `tid`=' . (int) $val);
}
return $t;
break;
case 'post-subject':
return Request::pass('post-subject');
break;
case 'theme-title':
return Request::pass('theme-title');
break;
case 'serie-title':
$t = Request::pass('serie-title');
if (!$t) {
$t = Database::sql2single('SELECT `title` FROM `series` WHERE `id`=' . (int) $val);
}
return $t;
break;
case 'shelf-name':
if ($val == 'loved') {
return 'Любимые книги';
}
return isset(Config::$shelves[Config::$shelfIdByNames[$val]]) ? Config::$shelves[Config::$shelfIdByNames[$val]] : $val;
break;
case 'magazine-title':
$query = 'SELECT `title` FROM `magazines` WHERE `id`=' . (int) $val;
return Database::sql2single($query);
break;
case 'thread-subject':
$query = 'SELECT `subject` FROM `users_messages` WHERE `id`=' . (int) $val;
return Database::sql2single($query);
break;
case 'get':
return $val;
break;
default:
throw new Exception('Cant process title part "' . $var[1] . '"');
break;
}
}
}
示例4: _update
function _update($data)
{
$tableName = News::getInstance()->tableName;
$this->dropCache();
return parent::_update($data, $tableName);
}
示例5: setCollectionClass
function setCollectionClass()
{
$this->Collection = News::getInstance();
}
示例6: fnShowNewColRight
function fnShowNewColRight($scope = "*", $catID, $limit = 10)
{
$modelNews = News::getInstance();
$dataCart = $modelNews->getTinTuc($scope, $catID, $limit);
$dataCart = $dataCart[$catID];
$items = $dataCart['contents'];
$tg = "";
if ($dataCart['redirect'] == 1) {
$dataCart['link'] = $dataCart['link_original'];
$tg = "_blank";
}
?>
<div class="box-std box-newscolumn">
<div class="box-title">
<h3 class="head"><a target="<?php
echo $tg;
?>
" href="<?php
echo $dataCart['link'];
?>
"><?php
echo $dataCart['title'];
?>
</a></h3>
</div>
<div class="inner">
<ul class="items">
<?php
for ($i = 0; $i < count($items); $i++) {
$item = $items[$i];
if ($dataCart['redirect'] == 1) {
$item['link'] = $item['link_original'];
$tg = "_blank";
}
?>
<li class="item">
<a target="<?php
echo $tg;
?>
" href="<?php
echo $item['link'];
?>
">
<img src="<?php
echo $item["thumbnail"];
?>
" />
<?php
echo $item["title"];
?>
</a>
<p class="time"><?php
echo date("H:i d/m/Y", strtotime($item['created']));
?>
</p>
</li>
<?php
}
?>
</ul>
</div>
</div>
<?php
}
示例7: unset
$newNick2 = $user['nick'] . '_';
unset($user['uid']);
$sqlp = array();
foreach ($user as $f => $v) {
$sqlp[] = '`' . $f . '`=' . Database::escape($v);
}
$query = 'INSERT INTO `users` SET
' . implode(',', $sqlp) . ' ON DUPLICATE KEY UPDATE `nick`=' . Database::escape($newNick2);
Database::query($query);
}
// news
Database::query('TRUNCATE `news`');
$query = 'SELECT * FROM `fashist`.`module_news` WHERE `type`=0';
$news = Database::sql2array($query, 'id');
foreach ($news as $id => $newsitem) {
$object = News::getInstance()->getById($id);
/* @var $object Newsitem */
$data = $newsitem;
$data['update_time'] = strtotime($data['update_time']);
$object->_create($data);
}
// releases
Database::query('TRUNCATE `releases`');
$query = 'SELECT * FROM `fashist`.`module_news` WHERE `type`=1';
$news = Database::sql2array($query, 'id');
foreach ($news as $id => $newsitem) {
$object = Releases::getInstance()->getById($id);
/* @var $object Release */
$data = $newsitem;
$data['update_time'] = strtotime($data['update_time']);
$object->_create($data);