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

PHP News类代码示例

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

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



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

示例1: testGetContent

 public function testGetContent()
 {
     Yii::app()->getModule('news');
     Yii::import('application.modules.news.models.*');
     $model = new News();
     $model->setAttributes(array('text' => 'comment 1', 'status' => News::STATE_ACTIVE), false);
 }
开发者ID:nizsheanez,项目名称:documentation,代码行数:7,代码来源:NewsTest.php


示例2: loadNewsList

 protected function loadNewsList()
 {
     $this->num_per_page = $this->db->real_escape_string($this->num_per_page);
     $this->page_num = $this->db->real_escape_string($this->page_num);
     $this->categoryID = trim($this->db->real_escape_string($this->categoryID));
     $start_record = $this->page_num * $this->num_per_page;
     $query = "select *,admin.username, na.createdDateTime as nacreatedDateTime from `newsarticle` na \n\t\t\t\tinner join `category` c on na.categoryID = c.categoryID\n\t\t\t\tinner join `administrator` admin on na.adminID = admin.adminID\n\t\t\t\twhere na.newsStatus = '" . $this->newsStatus . "'";
     if ($this->categoryID != "" && $this->categoryID > 0) {
         $query .= " and na.categoryID = " . $this->categoryID;
     }
     if ($this->onlyFollowed) {
         $query .= " and na.adminID in (select admin_id from editor_user where user_id=" . $this->onlyFollowed . ")";
     }
     $query .= " order by na.createdDateTime desc";
     $query .= " limit {$start_record}, {$this->num_per_page}";
     $newsArray = $this->db->query($query);
     if (is_array($newsArray) && count($newsArray) > 0) {
         $newsObj = new News(0, $this->summary_len);
         foreach ($newsArray as $id => $news) {
             $newsResult = $newsObj->setModelNews($news)->getArray();
             $newsArray[$id] = $newsResult["news"];
         }
         $this->newsMetaArr["newsMetaList"] = $newsArray;
     }
 }
开发者ID:cntjmj,项目名称:newslogue,代码行数:25,代码来源:nl-news-class.php


示例3: admin_news_create

function admin_news_create()
{
    if (isset($_REQUEST['create'])) {
        $news = new News();
        $news->title = $_REQUEST['title'];
        $news->content = $_REQUEST['content'];
        $news->tags = $_REQUEST['tags'];
        $news->protected = $_REQUEST['protected'];
        $news->custom_sidebar = $_POST['custom_sidebar'];
        if ($_POST['start_date_check'] == 1) {
            $news->start_date = strtotime($_POST['start_date']['year'] . "-" . $_POST['start_date']['month'] . "-" . $_POST['start_date']['day'] . "  " . str_pad($_POST['start_date']['hour'], 2, "0", STR_PAD_LEFT) . ":" . str_pad($_POST['start_date']['minute'], 2, "0", STR_PAD_LEFT) . "" . $_POST['start_date']['meridiem']);
        } else {
            $news->start_date = 0;
        }
        if ($_POST['end_date_check'] == 1) {
            $news->end_date = strtotime($_POST['end_date']['year'] . "-" . $_POST['end_date']['month'] . "-" . $_POST['end_date']['day'] . "  " . str_pad($_POST['end_date']['hour'], 2, "0", STR_PAD_LEFT) . ":" . str_pad($_POST['end_date']['minute'], 2, "0", STR_PAD_LEFT) . "" . $_POST['end_date']['meridiem']);
        } else {
            $news->end_date = 0;
        }
        $news->save();
        $news->created_on = date("Y-m-d H:i:s", strtotime($_POST['created_on']['year'] . "-" . $_POST['created_on']['month'] . "-" . $_POST['created_on']['day'] . "  " . str_pad($_POST['created_on']['hour'], 2, "0", STR_PAD_LEFT) . ":" . str_pad($_POST['created_on']['minute'], 2, "0", STR_PAD_LEFT) . "" . $_POST['created_on']['meridiem']));
        $news->save();
        render('news_list');
        return true;
    }
    render();
}
开发者ID:bjcpgd,项目名称:palserve,代码行数:27,代码来源:admin.php


示例4: load

 /**
  * Load your component.
  * 
  * @param \Cx\Core\ContentManager\Model\Entity\Page $page       The resolved page
  */
 public function load(\Cx\Core\ContentManager\Model\Entity\Page $page)
 {
     global $_CORELANG, $page, $objTemplate, $subMenuTitle;
     switch ($this->cx->getMode()) {
         case \Cx\Core\Core\Controller\Cx::MODE_FRONTEND:
             $newsObj = new News(\Env::get('cx')->getPage()->getContent());
             \Env::get('cx')->getPage()->setContent($newsObj->getNewsPage());
             $newsObj->getPageTitle(\Env::get('cx')->getPage()->getTitle());
             // Set the meta page description to the teaser text if displaying news details
             $teaser = $newsObj->getTeaser();
             if ($teaser !== null) {
                 //news details, else getTeaser would return null
                 $page->setMetadesc(contrexx_raw2xhtml(contrexx_strip_tags(html_entity_decode($teaser, ENT_QUOTES, CONTREXX_CHARSET))));
             }
             if (substr($page->getCmd(), 0, 7) == 'details') {
                 \Env::get('cx')->getPage()->setTitle($newsObj->newsTitle);
                 \Env::get('cx')->getPage()->setContentTitle($newsObj->newsTitle);
                 \Env::get('cx')->getPage()->setMetaTitle($newsObj->newsTitle);
             }
             break;
         case \Cx\Core\Core\Controller\Cx::MODE_BACKEND:
             $this->cx->getTemplate()->addBlockfile('CONTENT_OUTPUT', 'content_master', 'LegacyContentMaster.html');
             $objTemplate = $this->cx->getTemplate();
             \Permission::checkAccess(10, 'static');
             $subMenuTitle = $_CORELANG['TXT_NEWS_MANAGER'];
             $objNews = new NewsManager();
             $objNews->getPage();
             break;
         default:
             break;
     }
 }
开发者ID:nahakiole,项目名称:cloudrexx,代码行数:37,代码来源:ComponentController.class.php


示例5: go

 /**
  * 新闻列表
  * 
  * @return null
  * 
  */
 function go()
 {
     if (isset($_GET['get']) && $_GET['get'] == 1) {
         require_once "./protected/models/news.class.php";
         $newsList = new News();
         echo json_encode(array("rows" => $newsList->getPage($_POST['start'], $_POST['limit']), "results" => $newsList->countNum()));
     } else {
         if (isset($_POST['saveType'])) {
             $param1 = array();
             $param2 = array();
             if ($_POST['saveType'] === 'add') {
                 $param1 = array("id" => $_POST['id'], "title" => $_POST['title'], "content" => $_POST['content']);
             } else {
                 if ($_POST['saveType'] === 'remove') {
                     $param2 = explode(',', $_POST['ids']);
                 } else {
                     if ($_POST['saveType'] === 'update') {
                         $param1 = array("id" => $_POST['id'], "title" => $_POST['title'], "content" => $_POST['content']);
                     }
                 }
             }
             require_once "./protected/models/news.class.php";
             $news = new News($param1);
             echo json_encode($news->{$_POST}['saveType']($param2));
         } else {
             $pageInfo = $this->getPageInfo();
             $this->renderLayout('main', 'list', array('pageInfo' => $pageInfo));
         }
     }
 }
开发者ID:CaptDai,项目名称:h5rush,代码行数:36,代码来源:listAction.php


示例6: news_show

function news_show()
{
    global $news_show;
    $news = new News();
    $news_show = $news->find($_GET['id']);
    render();
}
开发者ID:bjcpgd,项目名称:palserve,代码行数:7,代码来源:news.php


示例7: getContent

 function getContent()
 {
     $err_msg = $_SESSION['LOGIN_RESULT'];
     $_SESSION['LOGIN_RESULT'] = "";
     $p = array();
     $d = new News($this->db_conn);
     //$d->debug = 1;
     $limit_str = " LIMIT 0, 5";
     $p['news_type'] = 1;
     $lists1 = $d->getListArray($p, $limit_str);
     $p['news_type'] = 2;
     $lists2 = $d->getListArray($p, $limit_str);
     $a = new Article($this->db_conn);
     $p['article_type'] = 1;
     $art1 = $a->getListArray($p, " LIMIT 0, 1");
     $p['article_type'] = 2;
     $art2 = $a->getListArray($p, " LIMIT 0, 1");
     $this->assign('data', $d);
     $this->assign('lists1', $lists1);
     $this->assign('lists2', $lists2);
     $this->assign('art1', $art1[0]);
     $this->assign('art2', $art2[0]);
     $this->assign('errmsg', $err_msg);
     //$this->assign('content_page', $this->template.$this->list_tpl);
 }
开发者ID:jcandrew1966,项目名称:as_woodhouse,代码行数:25,代码来源:IndexController.php


示例8: actionAddRandomNews

 public function actionAddRandomNews()
 {
     $news = new News();
     $news->title = "Item #" . rand(1, 10000);
     $news->created_on = time();
     $news->save();
     echo "OK";
 }
开发者ID:moohwaan,项目名称:yii-application-cookbook-2nd-edition-code,代码行数:8,代码来源:NewsController.php


示例9: save

 public function save(News $news)
 {
     if ($news->isValid()) {
         $news->isNew() ? $this->add($news) : $this->update($news);
     } else {
         throw new RuntimeException('La news doit être valide pour être enregistrée');
     }
 }
开发者ID:Guikingone,项目名称:JVN-Network,代码行数:8,代码来源:NewsManager.class.php


示例10: addNew

 static function addNew($titre, $image, $texte)
 {
     $new = new News();
     $new->titre = $titre;
     $new->image = "Vue/Image/" . $image;
     $new->contenu = $texte;
     $new->date = date("Y-m-d H:i:s");
     $new->save();
 }
开发者ID:unuldur,项目名称:ProjetPhp,代码行数:9,代码来源:Modele.php


示例11: update

 protected function update(News $news)
 {
     $requete = $this->db->prepare('UPDATE news SET auteur = :auteur, titre = :titre, contenu = :contenu, dateModif = NOW() WHERE id = :id');
     $requete->bindValue(':titre', $news->titre());
     $requete->bindValue(':auteur', $news->auteur());
     $requete->bindValue(':contenu', $news->contenu());
     $requete->bindValue(':id', $news->id(), PDO::PARAM_INT);
     $requete->execute();
 }
开发者ID:Guikingone,项目名称:JVN-Network,代码行数:9,代码来源:NewsManagerPDO.class.php


示例12: actionAdd

 public function actionAdd()
 {
     $NewsHeader = isset($_POST['NewsHeader']) ? $_POST['NewsHeader'] : null;
     $NewsPreview = isset($_POST['NewsPreview']) ? $_POST['NewsPreview'] : null;
     $NewsText = isset($_POST['NewsText']) ? $_POST['NewsText'] : null;
     $NewsTags = isset($_POST['NewsTags']) ? $_POST['NewsTags'] : null;
     $news = new News();
     $result = $news->CreateRecord($NewsHeader, $NewsPreview, $NewsText, $NewsTags);
     header('Location: ./index.php?block=News&action=getAll');
 }
开发者ID:Alexandr1987,项目名称:barricade,代码行数:10,代码来源:NewsAdminController.php


示例13: get_news

    public static function get_news($condition, array $parameters = array())
    {
        $row = self::$db_querier->select_single_row_query('SELECT news.*, member.*
		FROM ' . NewsSetup::$news_table . ' news 
		LEFT JOIN ' . DB_TABLE_MEMBER . ' member ON member.user_id = news.author_user_id
		' . $condition, $parameters);
        $news = new News();
        $news->set_properties($row);
        return $news;
    }
开发者ID:AroundPBT,项目名称:PHPBoost,代码行数:10,代码来源:NewsService.class.php


示例14: articleForm

 public function articleForm()
 {
     $form = new \Ease\TWB\Form('NewsArticle');
     $form->addItem(new \Ease\Html\InputHiddenTag('id', $this->newsEngine->getMyKey()));
     $form->addInput(new \Ease\Html\InputTextTag('name'), _('Name'));
     $form->addInput(new WISWYG('text'), _('Text'));
     $form->addItem(new \Ease\TWB\SubmitButton('Ok', 'success'));
     $form->fillUp($this->newsEngine->getData());
     return $form;
 }
开发者ID:VitexSoftware,项目名称:SkeliCZ,代码行数:10,代码来源:LyricsEditor.php


示例15: DeleteNews

 public function DeleteNews()
 {
     $news_obj = new News();
     $id = Input::get('id');
     if ($news_obj->DeleteNews($id)) {
         return Redirect::to('admin/listnews')->with('bao_thanh_cong', 'Xóa Thành Công');
     } else {
         return Redirect::back()->with('bao_loi', 'Xóa Thất Bại');
     }
 }
开发者ID:vudinhkien,项目名称:AdminBlog,代码行数:10,代码来源:NewsController.php


示例16: actionAdd

 protected function actionAdd()
 {
     $addart = new View('view/forms.php');
     $addart->display();
     if (isset($_POST['text']) && isset($_POST['title'])) {
         $article = new News();
         $article->title = $_POST['title'];
         $article->text = $_POST['text'];
         $article->save();
     }
 }
开发者ID:spoliv,项目名称:classfin,代码行数:11,代码来源:NewsController.php


示例17: actionAdd

 public function actionAdd()
 {
     $NewsHeader = isset($_POST['NewsHeader']) ? $_POST['NewsHeader'] : null;
     $NewsPreview = isset($_POST['NewsPreview']) ? $_POST['NewsPreview'] : null;
     $NewsText = isset($_POST['NewsText']) ? $_POST['NewsText'] : null;
     $NewsTags = isset($_POST['NewsTags']) ? $_POST['NewsTags'] : null;
     $news = new News();
     $result = $news->AddNews($NewsHeader, $NewsPreview, $NewsText, $NewsTags);
     //echo $result.' Added';
     header('Location: ./index.php?ctrl=News&act=All');
 }
开发者ID:Alexandr1987,项目名称:barricade,代码行数:11,代码来源:NewsAdminController.php


示例18: actionList

 public function actionList()
 {
     $this->breadcrumbs[] = array('title' => "Новости", 'url' => $this->createUrl("list"));
     $this->Title = "Новости";
     $model = new News("search");
     if (!empty($_GET['filter'])) {
         $model->attributes = $_GET['filter'];
     }
     $dataProvider = $model->search();
     $this->render("list", ["dP" => $dataProvider]);
 }
开发者ID:CrystReal,项目名称:Site_frontend,代码行数:11,代码来源:NewsController.php


示例19: testUniqueTitle

 public function testUniqueTitle()
 {
     $news = new News();
     $news->title = 'News';
     $news->body = 'FooBar';
     $this->assertTrue($news->save());
     $news = new News();
     $news->body = 'Ananas';
     $news->title = 'News';
     $this->assertFalse($news->save());
 }
开发者ID:BackupTheBerlios,项目名称:medick-svn,代码行数:11,代码来源:ValidatorTest.php


示例20: articleForm

 public function articleForm()
 {
     $form = new \Ease\TWB\Form('NewsArticle');
     $form->addItem(new \Ease\Html\InputHiddenTag('id', $this->newsEngine->getMyKey()));
     $form->addInput(new \Ease\Html\InputTextTag('title'), _('Name'));
     $form->addInput(new WISWYG('text'), _('Text'));
     $form->addInput(new \Ease\Html\Select('language', ['cs' => _('Czech'), 'en' => _('English')]), _('Language'));
     $form->addItem(new \Ease\TWB\SubmitButton('Ok', 'success'));
     $form->fillUp($this->newsEngine->getData());
     return $form;
 }
开发者ID:VitexSoftware,项目名称:SkeliCZ,代码行数:11,代码来源:NewsEditor.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP NewsModel类代码示例发布时间:2022-05-23
下一篇:
PHP Neuron_Core_Tools类代码示例发布时间: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