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

PHP NewsModel类代码示例

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

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



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

示例1: actionDel

 public function actionDel()
 {
     $del = new NewsModel();
     $del->id = [':id' => $_POST['id']];
     $del->del();
     header("Location: /index.php");
 }
开发者ID:Zerotul2015,项目名称:kemit,代码行数:7,代码来源:AdminController.php


示例2: actionSearch

 public function actionSearch()
 {
     $search = new NewsModel();
     $search->colummn = $_POST['column'];
     $search->value = $_POST['value'];
     $view = new View();
     $view->items = $search->findByColumn($search->colummn, $search->value);
     $view->display('search.php');
 }
开发者ID:Zerotul2015,项目名称:kemit,代码行数:9,代码来源:NewsController.php


示例3: actionFindByColumn

 public function actionFindByColumn()
 {
     $value = $_POST['title'];
     $findNews = new NewsModel();
     $find = $findNews->findByColumn('title', $value);
     $view = new View();
     $view->findNews = $find;
     $view->display('test.php');
 }
开发者ID:aosnafanja,项目名称:php.local,代码行数:9,代码来源:AdminController.php


示例4: news_one_show

 function news_one_show($id = null)
 {
     $one_news_model = new NewsModel();
     $one_news = $one_news_model->get_one_news($id);
     //        var_dump($news);die;
     $view = new View();
     $view->set_file_name('admin_news_one');
     $params = array('news' => $one_news);
     $view->show($params);
 }
开发者ID:levon379,项目名称:mvc,代码行数:10,代码来源:Admin.php


示例5: load

 function load()
 {
     parent::load();
     if (intval($this->data['new_gnews']) == 0 || $this->player->isSpy) {
         $this->redirect('village1.php');
         return null;
     }
     $m = new NewsModel();
     $this->siteNews = $m->getGlobalSiteNews();
     $m->dispose();
 }
开发者ID:vcelis,项目名称:tatar-wars,代码行数:11,代码来源:shownew.php


示例6: load

 public function load()
 {
     parent::load();
     if (intval($this->data['new_gnews']) == 0 || $this->player->isSpy) {
         $this->redirect("village1.php");
     } else {
         $m = new NewsModel();
         $this->siteNews = $m->getGlobalSiteNews();
         $m->dispose();
     }
 }
开发者ID:halshaman,项目名称:TravianDboor,代码行数:11,代码来源:shownew.php


示例7: viewNewsPage

    function viewNewsPage($user_id)
    {
        $htmlPage = "";
        $user_id = (int) $user_id;
        $newsModel = new NewsModel();
        $newsView = new NewsView();
        $aNewsSubscribe = $newsModel->getNewsSubscribeByUserId($user_id);
        if (!$aNewsSubscribe) {
            $aNewsTree = $newsView->getAllNewsTree();
            $isOnlySubscribeNewsTree = false;
        } else {
            $aNewsTree = $newsView->getNewsTreeByListNewsSubscribe($aNewsSubscribe);
            $isOnlySubscribeNewsTree = true;
        }
        $htmlPage = '<ul class="content-preview-list">';
        foreach ($aNewsTree as $newsTree) {
            /*    $newsCount = $newsView -> getNewsCountByNewsTreeId($newsTree['id'], $user_id, $isOnlySubscribeNewsTree);
                    if ($newsCount < 1) continue;
                    $htmlPage .= '
                 	<!-- Категория -->
                 	<div class="block_ee1"><div class="block_ee2"><div class="block_ee3"><div class="block_ee4">
                 		<div class="block_title">
                 			<div class="block_title_left">
                 			   <h2>
                 			   '.$newsView->ShowNewsTreeBreadCrumbByNewsTreeId($newsTree['id'], false).' (<a href="'.Project::getRequest()->createUrl('News', 'News', null, false).'/shownow:allnews/filterNewsTree:'.$newsTree['id'].'">все новости ['.$newsCount.']</a>)
                 			   </h2>
                 			</div>
                 			<div class="block_title_right"><img src="'.$this -> image_url.'close.png" width="21" height="24" onclick="ShowOrHide(this, \'rss_cat_n'.$newsTree['id'].'\')" style="cursor: pointer;" /></div>
                 		</div>'; */
            $htmlPage .= '<li class="expanded-view">
						<h3><a href="#">МИД России: Тбилиси выдает желаемое за действительное <img src="assets/i/temp/temp.1.jpg" alt="МИД России: Тбилиси выдает желаемое за действительное" /></a></h3>
						<p>В Москве опровергают сообщения о том, что якобы минувшим днем российские войска в Южной Осетии вели огонь по грузинской территории... <a href="#">»</a></p>
						<div class="meta">
							<span class="auth">Вести.Ru</span>
							<span class="date">20 минут назад</span>
						</div>
					</li>';
            /*		$htmlPage .= '<div id="rss_cat_n'.$newsTree['id'].'">'.
                          $newsView->ShowNewsListPreviewByNewsTreeId($newsTree['id'], 'full', $user_id, 4, array(), $isOnlySubscribeNewsTree).'
               		   <div class="rmb14"></div>
               		</div>
               
               	</div></div></div></div>
               	<!-- /Категория -->
                  '; */
        }
        $htmlPage .= '</ul>';
        return $htmlPage;
    }
开发者ID:amanai,项目名称:next24,代码行数:49,代码来源:HomeView.php


示例8: actionDelete

 public function actionDelete()
 {
     if (empty($_GET['id'])) {
         $message = 'There is no such news ';
         $this->errMSG($message);
     } else {
         $article = new NewsModel();
         $article->id = $_GET['id'];
         if ($article->deleteRow()) {
             $this->actionAll();
         } else {
             $this->errMSG('Fail Deleting a File');
         }
     }
 }
开发者ID:TTcuXOgaJI,项目名称:Test,代码行数:15,代码来源:NewsController.php


示例9: checkLog

 public function checkLog($ptable, $tstamp, $item)
 {
     switch ($ptable) {
         case 'tl_article':
             $objArticle = \ArticleModel::findById($item['pid']);
             $objPage = \PageModel::findById($objArticle->pid);
             $item['page'] = $objPage->title;
             $item['showUrl'] = $this->generateFrontendUrl($objPage->row(), '');
             break;
         case 'tl_news':
             $objNews = \NewsModel::findById($item['pid']);
             $objArchive = \NewsArchiveModel::findById($objNews->pid);
             $objPage = \PageModel::findById($objArchive->jumpTo);
             $item['page'] = $objNews->headline;
             $item['showUrl'] = ampersand($this->generateFrontendUrl($objPage->row(), (\Config::get('useAutoItem') && !\Config::get('disableAlias') ? '/' : '/items/') . (!\Config::get('disableAlias') && $objNews->alias != '' ? $objNews->alias : $objNews->id)));
             break;
         case 'tl_calendar':
             break;
         case 'tl_faq':
             $objFAQ = \FaqModel::findById($item['id']);
             $objCategory = \FaqCategoryModel::findById($item['pid']);
             $objPage = \PageModel::findById($objCategory->jumpTo);
             $item['htmlElement'] = '<div class="ce_faq"><h1>' . $objFAQ->question . '</h1>' . $objFAQ->answer . '</div>';
             $item['page'] = $objCategory->title;
             $item['title'] = $objFAQ->question;
             $item['showUrl'] = ampersand($this->generateFrontendUrl($objPage->row(), (\Config::get('useAutoItem') && !\Config::get('disableAlias') ? '/' : '/items/') . (!\Config::get('disableAlias') && $objFAQ->alias != '' ? $objFAQ->alias : $objFAQ->id)));
             break;
     }
     return $item;
 }
开发者ID:contao-dot-kitchen,项目名称:content_log,代码行数:30,代码来源:ClassContentLog.php


示例10: generateRelated

 /**
  * Generate the list in related categories mode
  *
  * Use the categories of the current news item. The module must be
  * on the same page as news reader module.
  *
  * @return string
  */
 protected function generateRelated()
 {
     // Set the item from the auto_item parameter
     if (!isset($_GET['items']) && $GLOBALS['TL_CONFIG']['useAutoItem'] && isset($_GET['auto_item'])) {
         \Input::setGet('items', \Input::get('auto_item'));
     }
     // Return if there is no item specified
     if (!\Input::get('items')) {
         return '';
     }
     $this->news_archives = $this->sortOutProtected(deserialize($this->news_archives));
     // Return if there are no archives
     if (!is_array($this->news_archives) || empty($this->news_archives)) {
         return '';
     }
     $news = \NewsModel::findPublishedByParentAndIdOrAlias(\Input::get('items'), $this->news_archives);
     // Return if the news item was not found
     if ($news === null) {
         return '';
     }
     $GLOBALS['NEWS_FILTER_CATEGORIES'] = false;
     $GLOBALS['NEWS_FILTER_DEFAULT'] = deserialize($news->categories, true);
     $GLOBALS['NEWS_FILTER_EXCLUDE'] = array($news->id);
     return parent::generate();
 }
开发者ID:codefog,项目名称:contao-news_categories,代码行数:33,代码来源:ModuleNewsList.php


示例11: compile

 /**
  * Generate the module
  */
 protected function compile()
 {
     global $objPage;
     $this->Template->articles = '';
     $this->Template->referer = 'javascript:history.go(-1)';
     $this->Template->back = $GLOBALS['TL_LANG']['MSC']['goBack'];
     // Get the news item
     $objArticle = \NewsModel::findPublishedByParentAndIdOrAlias(\Input::get('items'), $this->news_archives);
     if ($objArticle === null) {
         // Do not index or cache the page
         $objPage->noSearch = 1;
         $objPage->cache = 0;
         // Send a 404 header
         header('HTTP/1.1 404 Not Found');
         $this->Template->articles = '<p class="error">' . sprintf($GLOBALS['TL_LANG']['MSC']['invalidPage'], \Input::get('items')) . '</p>';
         return;
     }
     $arrArticle = $this->parseArticle($objArticle);
     $this->Template->articles = $arrArticle;
     // Overwrite the page title
     if ($objArticle->headline != '') {
         $objPage->pageTitle = strip_insert_tags($objArticle->headline);
     }
     // Overwrite the page description
     if ($objArticle->teaser != '') {
         $objPage->description = $this->prepareMetaDescription($objArticle->teaser);
     }
     // HOOK: comments extension required
     if ($objArticle->noComments || !in_array('comments', $this->Config->getActiveModules())) {
         $this->Template->allowComments = false;
         return;
     }
     $objArchive = $objArticle->getRelated('pid');
     $this->Template->allowComments = $objArchive->allowComments;
     // Adjust the comments headline level
     $intHl = min(intval(str_replace('h', '', $this->hl)), 5);
     $this->Template->hlc = 'h' . ($intHl + 1);
     $this->import('Comments');
     $arrNotifies = array();
     // Notify the system administrator
     if ($objArchive->notify != 'notify_author') {
         $arrNotifies[] = $GLOBALS['TL_ADMIN_EMAIL'];
     }
     // Notify the author
     if ($objArchive->notify != 'notify_admin') {
         if (($objAuthor = $objArticle->getRelated('author')) !== null && $objAuthor->email != '') {
             $arrNotifies[] = $objAuthor->email;
         }
     }
     $objConfig = new \stdClass();
     $objConfig->perPage = $objArchive->perPage;
     $objConfig->order = $objArchive->sortOrder;
     $objConfig->template = $this->com_template;
     $objConfig->requireLogin = $objArchive->requireLogin;
     $objConfig->disableCaptcha = $objArchive->disableCaptcha;
     $objConfig->bbcode = $objArchive->bbcode;
     $objConfig->moderate = $objArchive->moderate;
     $this->Comments->addCommentsToTemplate($this->Template, $objConfig, 'tl_news', $objArticle->id, $arrNotifies);
 }
开发者ID:rikaix,项目名称:core,代码行数:62,代码来源:ModuleNewsReader.php


示例12: actionFormDeletenews

 public function actionFormDeletenews()
 {
     $id = $_GET['id'];
     $news = NewsModel::getOneById($id);
     $view = new View();
     $view->item = $news;
     $view->display('admin/deletenews.php');
 }
开发者ID:Nilop,项目名称:mvctest,代码行数:8,代码来源:AdminController.php


示例13: modifyPalettes

 /**
  * Modify the palette according to the checkboxes selected
  *
  * @param mixed
  * @param DataContainer
  *
  * @return mixed
  */
 public function modifyPalettes()
 {
     $objNews = \NewsModel::findById($this->Input->get('id'));
     $dc =& $GLOBALS['TL_DCA']['tl_news'];
     if (!$objNews->addPreviewImage) {
         $dc['subpalettes']['addYouTube'] = str_replace('imgHeader,imgPreview,addPlayButton,', '', $dc['subpalettes']['addYouTube']);
     }
 }
开发者ID:heimrichhannot,项目名称:contao-youtube,代码行数:16,代码来源:tl_news.php


示例14: getNewsIntro

 public function getNewsIntro()
 {
     $news_items = NewsModel::getLatestNews(NEWS_ITEMS);
     $random_shot = ScreenshotsModel::getRandomScreenshot();
     $this->addCSSFiles(array('intro.css', 'news.css', '../javascripts/slimbox/css/slimbox2.css'));
     $this->addJSFiles(array('jquery-1.3.2.min.js', 'slimbox/js/slimbox2.js', 'introduction.js'));
     return $this->renderPage(array('title' => 'Home', 'content_title' => 'Latest Developments', 'show_intro' => true, 'news_items' => $news_items, 'news_archive_link' => true, 'random_shot' => $random_shot), $this->_template);
 }
开发者ID:bgK,项目名称:scummvm-web,代码行数:8,代码来源:NewsPage.php


示例15: index

 public function index()
 {
     // get medal list
     $medal_model = new MedalModel();
     $this->assign('medals', $medal_model->select());
     // get all the numbers
     $map_data_model = D('MapData');
     $ngo_num_record = $map_data_model->query_number(array('type' => 'exngo'));
     $csr_num_record = $map_data_model->query_number(array('type' => 'excsr'));
     $case_num_record = $map_data_model->query_number(array('type' => 'case'));
     $this->assign('ngo_num', $ngo_num_record);
     $this->assign('csr_num', $csr_num_record);
     $this->assign('case_num', $case_num_record);
     $news_model = new NewsModel();
     $news_list = $news_model->limit(20)->select();
     $this->assign('news_list', $news_list);
     $this->display();
 }
开发者ID:baixinxing,项目名称:ngo20map6,代码行数:18,代码来源:IndexAction.class.php


示例16: modifyPalette

 public static function modifyPalette()
 {
     $arrDca =& $GLOBALS['TL_DCA']['tl_news'];
     if (($objNews = \NewsModel::findByPk(\Input::get('id'))) !== null && $objNews->useMemberAuthor) {
         $arrDca['palettes']['default'] = str_replace(',author', ',', $arrDca['palettes']['default']);
     } else {
         $arrDca['palettes']['default'] = str_replace(',memberAuthor', ',', $arrDca['palettes']['default']);
     }
 }
开发者ID:heimrichhannot,项目名称:contao-frontendedit,代码行数:9,代码来源:tl_news.php


示例17: generateAlias

 public static function generateAlias()
 {
     if (TL_MODE == 'FE') {
         if (($objNews = \NewsModel::findByPk(\Input::get('id'))) !== null && $objNews->type == 'pinboard') {
             $objNews->alias = \HeimrichHannot\Haste\Dca\General::generateAlias($objNews->alias, $objNews->id, 'tl_news', $objNews->headline);
             $objNews->save();
         }
     }
 }
开发者ID:heimrichhannot,项目名称:contao-pinboard,代码行数:9,代码来源:tl_news.php


示例18: load

 public function load()
 {
     parent::load();
     if ($this->data['player_type'] != PLAYERTYPE_ADMIN) {
         exit(0);
     } else {
         $m = new NewsModel();
         $this->saved = FALSE;
         if ($this->isPost() && isset($_POST['news'])) {
             $this->siteNews = $_POST['news'];
             $this->saved = TRUE;
             $m->setGlobalPlayerNews($this->siteNews);
         } else {
             $this->siteNews = $m->getGlobalSiteNews();
         }
         $m->dispose();
     }
 }
开发者ID:halshaman,项目名称:TravianDboor,代码行数:18,代码来源:gnews.php


示例19: actionOne

 public function actionOne()
 {
     $id = $_GET['id'];
     $item = NewsModel::findOneByPk($id);
     if (empty($item)) {
         throw new E404Exception('Нет такой новости');
     }
     $view = new View();
     $view->item = $item;
     $view->display('news/one.php');
 }
开发者ID:AcidHardcore,项目名称:php2_6,代码行数:11,代码来源:NewsController.php


示例20: getAllNews

 /**
  * get all news items by page pid
  * @param array
  * @param integer
  * @param boolean
  * @return array
  */
 public static function getAllNews($arrPages, $intRoot = 0, $blnIsSitemap = false)
 {
     $arrRoot = array();
     if ($intRoot > 0) {
         $arrRoot = \Database::getInstance()->getChildRecords($intRoot, 'tl_page');
     }
     $time = time();
     $arrProcessed = array();
     // Get all news archives
     $objArchive = \NewsArchiveModel::findByProtected('');
     // Walk through each archive
     if ($objArchive !== null) {
         while ($objArchive->next()) {
             // Skip news archives without target page
             if (!$objArchive->jumpTo) {
                 continue;
             }
             // Skip news archives outside the root nodes
             if (!empty($arrRoot) && !in_array($objArchive->jumpTo, $arrRoot)) {
                 continue;
             }
             // Get the URL of the jumpTo page
             if (!isset($arrProcessed[$objArchive->jumpTo])) {
                 $objParent = \PageModel::findWithDetails($objArchive->jumpTo);
                 // The target page does not exist
                 if ($objParent === null) {
                     continue;
                 }
                 // The target page has not been published (see #5520)
                 if (!$objParent->published || $objParent->start != '' && $objParent->start > $time || $objParent->stop != '' && $objParent->stop < $time) {
                     continue;
                 }
                 // The target page is exempt from the sitemap (see #6418)
                 if ($blnIsSitemap && $objParent->sitemap == 'map_never') {
                     continue;
                 }
                 // Set the domain (see #6421)
                 // $domain = ($objParent->rootUseSSL ? 'https://' : 'http://') . ($objParent->domain ?: \Environment::get('host')) . TL_PATH . '/';
                 // Generate the URL
                 // $arrProcessed[$objArchive->jumpTo] = $domain . $this->generateFrontendUrl($objParent->row(), ((\Config::get('useAutoItem') && !\Config::get('disableAlias')) ?  '/%s' : '/items/%s'), $objParent->language);
             }
             $strUrl = $arrProcessed[$objArchive->jumpTo];
             // Get the items
             $objArticle = \NewsModel::findPublishedDefaultByPid($objArchive->id);
             if ($objArticle !== null) {
                 while ($objArticle->next()) {
                     $arrPages[] = $objArticle->id;
                 }
             }
         }
     }
     return $arrPages;
 }
开发者ID:heimrichhannot,项目名称:contao-news_plus,代码行数:60,代码来源:NewsPlus.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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