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


PHP News::get_news方法代码示例

本文整理汇总了PHP中News::get_news方法的典型用法代码示例。如果您正苦于以下问题:PHP News::get_news方法的具体用法?PHP News::get_news怎么用?PHP News::get_news使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在News的用法示例。


在下文中一共展示了News::get_news方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: show_more

 function show_more()
 {
     header('Content-Type: text/html; charset=utf-8');
     global $display;
     $anchor_index = intval(Url::get('anchor_index', 0));
     $cid = intval(Url::get('cid', 0));
     if ($cid != 0) {
         $where = ' AND category_id = ' . $cid;
     }
     $item_per_page = 20;
     $list_news = News::get_news($where, $anchor_index * $item_per_page, $item_per_page + 1);
     if (count($list_news) == $item_per_page + 1) {
         $is_next = 1;
         array_pop($list_news);
     } else {
         $is_next = 0;
     }
     if (empty($list_news)) {
         exit;
     }
     $display->add('list_news', $list_news);
     $display->add('anchor_index', $anchor_index);
     $display->add('is_next', $is_next);
     $display->output('CmsNews/ajax/ShowMore');
     exit;
 }
开发者ID:hqd276,项目名称:bigs,代码行数:26,代码来源:ajax_news.ajax.php

示例2: draw

 function draw()
 {
     global $display;
     $type = (int) $_SESSION['type'];
     if ($type < 0) {
         $type = 0;
     }
     $cat_id = intval(Url::get('catid', 0));
     if ($cat_id != 0) {
         $where = ' AND category_id = ' . $cat_id;
     }
     $where .= ' AND type = ' . $type;
     $item_per_page = 5;
     $list_news = News::get_news($where, 0, $item_per_page);
     if (count($list_news > 0)) {
         foreach ($list_news as $key => $value) {
             // $list_news[$key]['title'] = Util::split_char($value['title'],40,-1) . ' ...';
             if ($value['uid'] > 0) {
                 $author = User::getUserById($value['uid']);
                 // var_dump($author);die;
                 if ($author['full_name'] == '') {
                     $list_news[$key]['author'] = $author['user_name'];
                 } else {
                     $list_news[$key]['author'] = $author['full_name'];
                 }
             }
         }
     }
     $display->add('list_news', $list_news);
     $display->add('cid', $cat_id);
     $display->add('uid', User::id());
     $display->output("List");
 }
开发者ID:hqd276,项目名称:bigs,代码行数:33,代码来源:list.php

示例3: htmlspecialchars

    if ($settings['enable_fullfeeds'] && $_GET['get_1'] == 'rss-fullfeed') {
        $template->assign('rss_items', $news->get_feed($settings['rss_maximum_items'], true));
        if (isset($cache)) {
            $cache->cacheId = PAGE . ',rss-fullfeed';
        }
    } else {
        $template->assign('rss_items', $news->get_feed($settings['rss_maximum_items'], false));
        if (isset($cache)) {
            $cache->cacheId = PAGE . ',rss';
        }
    }
    $template->assign('wfw', $news->wfw);
    $content_type = 'text/xml';
    $template_file = 'rss.tpl';
} else {
    $template->assign('news', $news->get_news());
    $template->assign('current_category', htmlspecialchars($news->category));
    $template->assign('current_category_urlencoded', $news->category_urlencoded);
    $template->assign('subtemplate', 'news.inc.tpl');
    $template->assign('pagination', pagination($news->total_pages, $news->current_page));
    if (isset($cache)) {
        if ($news->category && $news->current_page == 1) {
            $cache->cacheId = PAGE . ',' . CATEGORY_IDENTIFIER . str_replace('&', AMPERSAND_REPLACEMENT, $news->category);
        } elseif ($news->current_page > 1) {
            if ($news->category) {
                $category = CATEGORY_IDENTIFIER . str_replace('&', AMPERSAND_REPLACEMENT, $news->category);
            } else {
                $category = '';
            }
            $cache->cacheId = PAGE . ',' . $category . ',' . $news->current_page;
        } else {
开发者ID:adartk,项目名称:phpsqlitecms,代码行数:31,代码来源:news.php


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