当前位置: 首页>>代码示例>>PHP>>正文


PHP News::getInstance方法代码示例

本文整理汇总了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);
 }
开发者ID:ducdm87,项目名称:gamelienminh,代码行数:29,代码来源:CategoryController.php

示例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();
     }
 }
开发者ID:rasstroen,项目名称:hardtechno,代码行数:14,代码来源:NewsWriteModule.php

示例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;
         }
     }
 }
开发者ID:rasstroen,项目名称:sovet,代码行数:88,代码来源:PageConstructor.php

示例4: _update

 function _update($data)
 {
     $tableName = News::getInstance()->tableName;
     $this->dropCache();
     return parent::_update($data, $tableName);
 }
开发者ID:rasstroen,项目名称:hardtechno,代码行数:6,代码来源:Newsitem.php

示例5: setCollectionClass

 function setCollectionClass()
 {
     $this->Collection = News::getInstance();
 }
开发者ID:rasstroen,项目名称:hardtechno,代码行数:4,代码来源:news_module.php

示例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 
}
开发者ID:ducdm87,项目名称:gamelienminh,代码行数:64,代码来源:functions.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);
开发者ID:rasstroen,项目名称:hardtechno,代码行数:31,代码来源:convert.php


注:本文中的News::getInstance方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。