• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP news类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中news的典型用法代码示例。如果您正苦于以下问题:PHP news类的具体用法?PHP news怎么用?PHP news使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



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

示例1: index

 public function index($arguments)
 {
     $news = new news(ConnectionFactory::get('mongo'));
     $articles = new articles(ConnectionFactory::get('mongo'));
     $notices = new notices(ConnectionFactory::get('redis'));
     $irc = new irc(ConnectionFactory::get('redis'));
     $quotes = new quotes(ConnectionFactory::get('mongo'));
     $forums = new forums(ConnectionFactory::get('redis'));
     // Set all site-wide notices.
     foreach ($notices->getAll() as $notice) {
         Error::set($notice, true);
     }
     // Fetch the easy data.
     $this->view['news'] = $news->getNewPosts();
     $this->view['shortNews'] = $news->getNewPosts(true);
     $this->view['newArticles'] = $articles->getNewPosts('new', 1, 5);
     $this->view['ircOnline'] = $irc->getOnline();
     $this->view['randomQuote'] = $quotes->getRandom();
     $this->view['fPosts'] = $forums->getNew();
     // Get online users.
     $apc = new APCIterator('user', '/' . Cache::PREFIX . 'user_.*/');
     $this->view['onlineUsers'] = array();
     while ($apc->valid()) {
         $current = $apc->current();
         array_push($this->view['onlineUsers'], substr($current['key'], strlen(Cache::PREFIX) + 5));
         $apc->next();
     }
     // Set title.
     Layout::set('title', 'Home');
 }
开发者ID:Zandemmer,项目名称:HackThisSite-Old,代码行数:30,代码来源:index.php


示例2: displayNews

/**
 * @package pragyan
 * @copyright (c) 2008 Pragyan Team
 * @license http://www.gnu.org/licenses/ GNU Public License
 * For more details, see README
 */
function displayNews()
{
    $news = <<<NEWS
\t\t<style type="text/css">
\t\ta.tickl{font-family:Verdana,Arial,Helvetica,sans-serif;font-size:11px;line-height:12px;text-decoration:none;color:#fff;font-weight:bold;}
\t\t.tickls{color:#666;}
\t\t</style>
\t\t<div id="newsbox" style="font-size:0.9em;position:absolute;right:45px;width:375px;top:80px;color:#fff;z-index:2;">
\t\t<div class="ticki" >
\t\t<a class="tickl" href="/08/home/news/"><span class="tickls">UPDATES</span></a>
\t\t<a id="tickerAnchor" class="tickl" target="_top" href=""></a>
\t\t</div>
\t\t</div>
\t\t<script type="text/javascript" language="JavaScript">
\t\t <!--
\t\t var theCharacterTimeout = 50;
\t\t var theStoryTimeout = 5000;
\t\t var theWidgetOne = "_";
\t\t var theWidgetTwo = "-";
\t\t var theWidgetNone = "";
\t\t var theLeadString = ":&nbsp;";
\t\t var theSummaries = new Array();
\t\t var theSiteLinks = new Array();
NEWS;
    global $sourceFolder;
    global $moduleFolder;
    global $urlRequestRoot;
    global $pageIdArray;
    require_once "{$sourceFolder}/{$moduleFolder}/news.lib.php";
    $tmpNewsObj = new news();
    $pageFullPath = "/news/";
    ///<Replace with path of news page
    $pageId = parseUrlReal($pageFullPath, $pageIdArray);
    $pageInfo = getPageInfo($pageId);
    $newsArray = $tmpNewsObj->getNewsArray($pageInfo['page_modulecomponentid']);
    $news .= "var theItemCount =" . sizeof($newsArray) . ";";
    for ($i = 0; $i < sizeof($newsArray); $i++) {
        $newsFeed = $newsArray[$i]['news_title'];
        $newsFeed .= " - " . $newsArray[$i]['news_feed'];
        $newsLink = $newsArray[$i]['news_link'];
        //		displayerror()
        if (strlen($newsFeed) >= 48) {
            $newsFeed = substr($newsFeed, 0, 48);
            $newsFeed = substr($newsFeed, 0, strrpos($newsFeed, " "));
            $newsFeed .= "...";
        }
        $news .= "theSummaries[{$i}] = \"{$newsFeed}\";";
        if ($newsLink == "") {
            $newsLink = $urlRequestRoot . $pageFullPath . "&id=" . $newsArray[$i]['news_id'];
        }
        $news .= "theSiteLinks[{$i}] = \"{$newsLink}\";";
    }
    $news .= <<<NEWS
\t\t startTicker();
\t\t //-->
\t\t</script>
NEWS;
    return $news;
}
开发者ID:ksb1712,项目名称:pragyan,代码行数:65,代码来源:news.php


示例3: index

 public function index($arguments)
 {
     Layout::set('title', 'Search');
     if (empty($_POST['query'])) {
         return Error::set('No search query found.');
     }
     $query = substr(trim(htmlentities($_POST['query'], ENT_QUOTES, 'ISO8859-1', false)), 0, 250);
     $results = Search::query($query);
     if ($results['hits']['total'] == 0) {
         return Error::set('No results found.');
     }
     $this->view['results'] = array();
     $news = new news(ConnectionFactory::get('mongo'));
     $articles = new articles(ConnectionFactory::get('mongo'));
     $lectures = new lectures(ConnectionFactory::get('mongo'));
     $i = 1;
     if (empty($results['hits']['hits'])) {
         return;
     }
     foreach ($results['hits']['hits'] as $result) {
         $entry = $result['_source'];
         switch ($entry['type']) {
             case 'news':
                 $post = $news->get($result['_id'], false, true);
                 if (empty($post)) {
                     continue;
                 }
                 $post['type'] = 'news';
                 array_push($this->view['results'], $post);
                 break;
             case 'article':
                 $article = $articles->get($result['_id'], false, true);
                 if (empty($article)) {
                     continue;
                 }
                 $article['type'] = 'article';
                 array_push($this->view['results'], $article);
                 break;
             case 'lecture':
                 $lecture = $lectures->get($result['_id'], false, true);
                 if (empty($lecture)) {
                     continue;
                 }
                 $lecture['type'] = 'lecture';
                 array_push($this->view['results'], $lecture);
                 break;
         }
         if ($i == 5) {
             break;
         }
         ++$i;
     }
 }
开发者ID:Zandemmer,项目名称:HackThisSite-Old,代码行数:53,代码来源:search.php


示例4: load

 public function load(ObjectManager $manager)
 {
     $information = new Information();
     $information->setTitle("About Me");
     $information->setBody("<p>Rofilde Hasudungan research are in DNA based Computer</p>");
     $information->setPublished(true);
     $manager->persist($information);
     $news = new news();
     $news->setTitle("About Me");
     $news->setBody("<p>Rofilde Hasudungan research are in DNA based Computer</p>");
     $news->setPublished(true);
     $manager->persist($news);
     $manager->flush();
 }
开发者ID:rhsitorus,项目名称:simple-content,代码行数:14,代码来源:LoadContentData.php


示例5:

 if ($mode == 'own') {
     $where = 'news.author=' . $_SESSION['userid'];
 }
 $query = 'news.id, 
         news.active, 
         news.start,
         news.end, 
         news.author,
         person.first_name as author_first_name,
         person.last_name as author_last_name, 
         news.topic, 
         news.text 
        from news 
        join person on
开发者ID:BackupTheBerlios,项目名称:infoschool-svn,代码行数:14,代码来源:func.php


示例6: pageNews

 public function pageNews()
 {
     $lang = services::getService('lang');
     $params = services::getService('pageParams');
     $this->page();
     $this->setTemplate('news.tpl');
     // newsscript: show news headlines
     $shownews = new news();
     $shownews->id = $params->getParam('news_id');
     $shownews->find(true);
     $this->shownews = array('name' => $shownews->name, 'abstract' => $shownews->abstract, 'text' => $shownews->text, 'date' => date('d. m. Y', $shownews->date), 'id' => $shownews->id);
     // output
     $this->assignAll();
     $this->display();
 }
开发者ID:BackupTheBerlios,项目名称:cosmopool-multi-svn,代码行数:15,代码来源:pageNews.php


示例7: actionGetArticle

 public function actionGetArticle($view)
 {
     $article_id = (int) $_GET['article'];
     $article = news::getArticle($article_id);
     $view->article = $article;
     echo $view->render('article.php');
 }
开发者ID:Jluct,项目名称:obuceisea,代码行数:7,代码来源:newsController.php


示例8: vote

 public function vote($arguments)
 {
     if (!CheckAcl::can('voteOnNews')) {
         return Error::set('You can not vote on news posts.');
     }
     if (empty($arguments[0]) || empty($arguments[1])) {
         return Error::set('Vote or news id not found.');
     }
     $news = new news(ConnectionFactory::get('mongo'));
     $result = $news->castVote($arguments[0], $arguments[1]);
     $post = $news->get($arguments[0], false, true);
     if (is_string($result)) {
         return Error::set($result, false, array('Back' => Url::format('/news/view/' . Id::create($post, 'news'))));
     }
     Error::set('Vote cast!', true, array('Back' => Url::format('/news/view/' . Id::create($post, 'news'))));
 }
开发者ID:Zandemmer,项目名称:HackThisSite-Old,代码行数:16,代码来源:news.php


示例9: actionAll

 public function actionAll()
 {
     $news = news::getAll();
     $view = new view();
     $view->items = $news;
     $view->display('news/all.php');
 }
开发者ID:seclace,项目名称:news,代码行数:7,代码来源:newsController.php


示例10: get_cha

 function get_cha()
 {
     if ($_GET['module'] == 'news') {
         if (intval($_GET['cha']) > 0) {
             return intval($_GET['cha']);
         } elseif (intval($_GET['cat']) > 0) {
             $cat = new category_news();
             $row = $cat->detail($_GET['cat']);
             return $row['cha_id'];
         } elseif (intval($_GET['id']) > 0) {
             $news = new news();
             $row = $news->detail('cha_id', $_GET['id']);
             return $row['cha_id'];
         }
     } else {
         return 0;
     }
 }
开发者ID:sydneyDAD,项目名称:cardguys.com,代码行数:18,代码来源:class_channel_news.php


示例11: displayNew

function displayNew()
{
    global $sourceFolder;
    global $moduleFolder;
    global $urlRequestRoot;
    global $pageIdArray;
    require_once "{$sourceFolder}/{$moduleFolder}/news.lib.php";
    $tmpNewsObj = new news();
    $pageFullPath = "/whatsnew/";
    ///<Replace with path of news page
    $pageId = parseUrlReal($pageFullPath, $pageIdArray);
    $pageInfo = getPageInfo($pageId);
    $newsArray = $tmpNewsObj->getNewsArray($pageInfo['page_modulecomponentid']);
    $newsFeed = '';
    for ($i = 0; $i < sizeof($newsArray); $i++) {
        $newsTitle = str_replace("'", "&#39;", $newsArray[$i]['news_title']);
        $newsBody = str_replace("'", "&#39;", $newsArray[$i]['news_feed']);
        $newsTitle = rtrim($newsTitle);
        $newsBody = rtrim($newsBody);
        $days = 20;
        //		if(time()<(strtotime($newsArray[$i]['news_date'])+($days*24*60*60))) {
        //			$newsBody .= '<font color="#f9dc72"><strong> NEW!</strong></font>';
        //		}
        if ($newsArray[$i]['news_link'] == '') {
            $newsFeed .= '\'<a href=/09/home/whatsnew>' . $newsTitle . ' ' . $newsBody . '</a>\',';
        } else {
            $newsFeed .= '\'<a href=' . $newsArray[$i]['news_link'] . '>' . $newsTitle . ' ' . $newsBody . '</a>\',';
        }
    }
    $newsFeed = rtrim($newsFeed, ',');
    /**
    		if (strlen($newsFeed) >= 48) {
    			$newsFeed = substr($newsFeed, 0, 48);
    			$newsFeed = substr($newsFeed, 0, strrpos($newsFeed, " "));
    			$newsFeed .= "...";
    		}
    */
    $news = <<<NEWS
<script>
var pausecontent2=new Array({$newsFeed})
</script>
NEWS;
    return $news;
}
开发者ID:ksb1712,项目名称:pragyan,代码行数:44,代码来源:news.kid.php


示例12: load

 public static function load($view_rep, $view_file)
 {
     if (tg('_tsk') == 'news') {
         $instance = new news();
         $array = $instance->index();
     }
     if (isset($array)) {
         $titre = lg('TITR') . ' | ' . $array['titre'];
         $content = htmlentities($array['titre']);
         $image = "http://{$_SERVER['HTTP_HOST']}" . criimg_link('upload/news/' . $array['img'], 200, 200, 'PNG');
         $actual_link = "http://{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}";
     } else {
         $titre = lg('TITR');
         $content = 'Site Internet Officiel de la présidence de la République du Tchad.';
         $image = './img/header.jpg';
         $actual_link = "http://{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}";
     }
     include_once AFFICH_REP . 'layout/header.php';
     include_once AFFICH_REP . 'layout/limen.php';
     include_once AFFICH_REP . $view_rep . SLASH . $view_file . '_v.php';
 }
开发者ID:ATS001,项目名称:PRSIT,代码行数:21,代码来源:view.class.php


示例13: displayNews2

/**
 * @package pragyan
 * @copyright (c) 2008 Pragyan Team
 * @license http://www.gnu.org/licenses/ GNU Public License
 * For more details, see README
 */
function displayNews2()
{
    global $sourceFolder;
    global $moduleFolder;
    global $urlRequestRoot;
    global $pageIdArray;
    require_once "{$sourceFolder}/{$moduleFolder}/news.lib.php";
    $tmpNewsObj = new news();
    $pageFullPath = "/news/";
    ///<Replace with path of news page
    $pageId = parseUrlReal($pageFullPath, $pageIdArray);
    $pageInfo = getPageInfo($pageId);
    $newsArray = $tmpNewsObj->getNewsArray(0);
    for ($i = 0; $i < sizeof($newsArray); $i++) {
        $divopen = "<div class=\"news_style\" rel=\"{$newsArray[$i]}[news_title]\" id=\"news{$i}\">";
        $heading = "<h4>{$newsArray[$i]}[news_title]</h4>";
        $content = "{$newsArray[$i]}[news_feed]";
        $divclose = "</div>";
        $fulldiv = $divopen . $heading . $content . $divclose;
        echo $fulldiv;
    }
    return 1;
}
开发者ID:ksb1712,项目名称:pragyan,代码行数:29,代码来源:news.kulz.php


示例14: array_slice

 }
 $smarty->assign("T_FORUM_OPTIONS", $forum_options);
 //Assign forum options to smarty
 /*Lesson announcements list*/
 if (!isset($currentUser->coreAccess['news']) || $currentUser->coreAccess['news'] != 'hidden') {
     if (!empty($lessons_list)) {
         if ($currentUser->getType() == "student") {
             //See only non-expired news
             $news = news::getNews(0, true) + news::getNews($lessons_list, true);
         } else {
             //See both expired and non-expired news
             $news = news::getNews(0, true) + news::getNews($lessons_list, false);
         }
     } else {
         //Administrator news, he doesn't have to see lesson news (since he can't actually access them)
         $news = news::getNews(0, true);
     }
     $news = array_slice($news, 0, 10, true);
     $smarty->assign("T_NEWS", $news);
     //Assign announcements to smarty
 }
 /*Comments list*/
 if (!empty($lessons_list)) {
     $comments = eF_getTableData("comments cm JOIN content c JOIN lessons l ON c.lessons_ID = l.id", "cm.id AS id, cm.data AS data, cm.users_LOGIN AS users_LOGIN, cm.timestamp AS timestamp, c.name AS content_name, c.id AS content_ID, c.ctg_type AS content_type, l.name as show_lessons_name, l.id as show_lessons_id", "c.lessons_ID IN ('" . implode("','", $lessons_list) . "') AND cm.content_ID=c.id AND c.active=1 AND cm.active=1 AND cm.private=0", "cm.timestamp DESC LIMIT 5");
     if ($_SESSION['s_type'] != 'administrator' && $_SESSION['s_current_branch']) {
         //this applies to supervisors only
         $currentBranch = new EfrontBranch($_SESSION['s_current_branch']);
         $branchTreeUsers = array_keys($currentBranch->getBranchTreeUsers());
         foreach ($comments as $key => $value) {
             if (!in_array($value['users_LOGIN'], $branchTreeUsers)) {
                 unset($comments[$key]);
开发者ID:kaseya-university,项目名称:efront,代码行数:31,代码来源:social.php


示例15: intval

if ($action == 'all' || $action == 'cat') {
    $sub_action = intval(varset($tmp[1], 0));
}
if ($action == 'extend' && empty($sub_action)) {
    $defaultUrl = e107::getUrl()->create('news/list/items');
    e107::getRedirect()->go($defaultUrl, null, 301);
    exit;
}
/*
Variables Used:
$action - the basic display format/filter
$sub_action - category number or news item number
$newsfrom - first item number in list (default 0) - derived from nextprev
$order - sets the listing order for 'list' format
*/
$ix = new news();
$nobody_regexp = "'(^|,)(" . str_replace(",", "|", e_UC_NOBODY) . ")(,|\$)'";
// URL settings (nextprev)
$newsUrlparms = array('page' => '--FROM--');
if ($sub_action) {
    switch ($action) {
        case 'list':
            $newsUrlparms['id'] = $sub_action;
            $newsRoute = 'list/category';
            break;
        case 'cat':
            $newsUrlparms['id'] = $sub_action;
            $newsRoute = 'list/short';
            break;
        case 'day':
        case 'month':
开发者ID:xxlinkexx,项目名称:e107,代码行数:31,代码来源:news.php


示例16: news

        <div class="table">
            <div class="nav">
                <label  class="active">新闻列表</label>
                <a href="add.html"><label>添加新闻</label></a>
            </div>
            <div class="form">
                <table cellspacing="0px" class="admins">
                    <tr>
                        <th width="100">新闻编号</th>
                        <th width="200">标题</th>
                        <th width="300">内容</th>
                        <th width="200">操作</th>
                    </tr>
                    <?php 
require "model.php";
$news = new news();
$result = $news->selectAll();
foreach ($result as $item) {
    ?>
                    <tr>
                        <td class="id"><?php 
    echo $item->id;
    ?>
</td>
                        <td><?php 
    echo $item->title;
    ?>
</td>
                        <td><?php 
    echo $item->content;
    ?>
开发者ID:zuiyu,项目名称:homework,代码行数:31,代码来源:manage.php


示例17: news

///
///	[Copyright]
///		Copyright 2007-2008 prolove. All rights reserved.
///
///	[Filename]
///		学生项目申请首页类
///
///	[Description]
///		学生项目申请首页类页面
///
///	[History]
///		Date        	Version  	Author    	Content
///		---------- 	 -------  	--------  	 ------------------------------------
///	    2009/11/16      1.1    	龙首成      	  学生管理
require_once "news.class.php";
$news = new news();
$noticdata = $news->getNotice();
$id = intval($_GET['id']);
$news->setTableName('notic');
$data = $news->selectA(array('notic_id' => $id));
$title = "通知 > " . $data[0]['notic_title'];
require_once "header.php";
?>
		<div id="right" style="width:648px;border:#C1C1C1 solid 1px;background-color:#FFF0F0;float:left">
		  	<div id="item" style="border:#c1c1c1 solid 1px;margin-bottom:20px;text-align:center">
					<h3 style="color:red"><?php 
echo $data[0]['notic_title'];
?>
</h3>
					
					<p>发布时间:<?php 
开发者ID:dalinhuang,项目名称:hnaust-1,代码行数:31,代码来源:notice.php


示例18: defined

<?php

defined('IN_DESTOON') or exit('Access Denied');
login();
require DT_ROOT . '/module/' . $module . '/common.inc.php';
if ($_groupid > 5 && !$_edittime && $action == 'add') {
    dheader($MODULE[2]['linkurl'] . 'edit.php?tab=2');
}
$MG['homepage'] && $MG['news_limit'] > -1 or dalert(lang('message->without_permission_and_upgrade'), 'goback');
require DT_ROOT . '/include/post.func.php';
$TYPE = get_type('news-' . $_userid);
require MD_ROOT . '/news.class.php';
$do = new news();
switch ($action) {
    case 'add':
        if ($MG['news_limit']) {
            $r = $db->get_one("SELECT COUNT(*) AS num FROM {$DT_PRE}news WHERE username='{$_username}' AND status>0");
            if ($r['num'] >= $MG['news_limit']) {
                dalert(lang($L['limit_add'], array($MG['news_limit'], $r['num'])), 'goback');
            }
        }
        if ($submit) {
            if ($do->pass($post)) {
                $post['username'] = $_username;
                $post['level'] = $post['addtime'] = 0;
                $need_check = $MOD['news_check'] == 2 ? $MG['check'] : $MOD['news_check'];
                $post['status'] = get_status(3, $need_check);
                $do->add($post);
                dmsg($L['op_add_success'], '?status=' . $post['status']);
            } else {
                message($do->errmsg);
开发者ID:hiproz,项目名称:zhaotaoci.cc,代码行数:31,代码来源:news.inc.php


示例19: switch

$model = $_REQUEST['model'];
$action = $_REQUEST['action'];
include_once MODELS_ADMIN . "/" . $model . "_model.php";
switch (strtoupper($action)) {
    case 'ADD':
        break;
    case 'SAVE':
        $objNews = new news();
        $objNews->setNews($_REQUEST);
        $objComm->redirect('index.php?model=' . $model);
        break;
    case 'VIEW':
    case 'EDIT':
        $objNews = new news();
        $row = $objNews->getNews($_REQUEST['id']);
        break;
    case 'UPDATE':
        $objNews = new news();
        $objNews->setNews($_REQUEST);
        $objComm->redirect('index.php?model=' . $model . '&action=edit&id=' . $_REQUEST['pk_id']);
        break;
    case 'DELETE':
        $objNews = new news();
        $objNews->delNews($_REQUEST['id']);
        $objComm->redirect('index.php?model=' . $model);
        break;
    default:
        $objNews = new news();
        $Records = $objNews->getAllNews();
        break;
}
开发者ID:business-expert,项目名称:aiclubnew,代码行数:31,代码来源:news.php


示例20: news

<?php

require_once "model.php";
$type = $_GET['type'];
$first = $_GET['first'] ? $_GET['first'] : 0;
$news = new news();
echo $news->select("news", $first);
开发者ID:zuiyu,项目名称:homework,代码行数:7,代码来源:news.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP nggAdmin类代码示例发布时间:2022-05-23
下一篇:
PHP networking类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap