當前位置: 首頁>>代碼示例>>PHP>>正文


PHP NewsModel::findPublishedDefaultByPid方法代碼示例

本文整理匯總了PHP中NewsModel::findPublishedDefaultByPid方法的典型用法代碼示例。如果您正苦於以下問題:PHP NewsModel::findPublishedDefaultByPid方法的具體用法?PHP NewsModel::findPublishedDefaultByPid怎麽用?PHP NewsModel::findPublishedDefaultByPid使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在NewsModel的用法示例。


在下文中一共展示了NewsModel::findPublishedDefaultByPid方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: 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

示例2: getSearchablePages

 /**
  * Add news items to the indexer
  *
  * @param array   $arrPages
  * @param integer $intRoot
  * @param boolean $blnIsSitemap
  *
  * @return array
  */
 public function getSearchablePages($arrPages, $intRoot = 0, $blnIsSitemap = false)
 {
     $arrRoot = array();
     if ($intRoot > 0) {
         $arrRoot = $this->Database->getChildRecords($intRoot, 'tl_page');
     }
     $arrProcessed = array();
     $time = \Date::floorToMinute();
     // 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 + 60) {
                     continue;
                 }
                 if ($blnIsSitemap) {
                     // The target page is protected (see #8416)
                     if ($objParent->protected) {
                         continue;
                     }
                     // The target page is exempt from the sitemap (see #6418)
                     if ($objParent->sitemap == 'map_never') {
                         continue;
                     }
                 }
                 // Generate the URL
                 $arrProcessed[$objArchive->jumpTo] = $objParent->getAbsoluteUrl(\Config::get('useAutoItem') ? '/%s' : '/items/%s');
             }
             $strUrl = $arrProcessed[$objArchive->jumpTo];
             // Get the items
             $objArticle = \NewsModel::findPublishedDefaultByPid($objArchive->id);
             if ($objArticle !== null) {
                 while ($objArticle->next()) {
                     $arrPages[] = $this->getLink($objArticle, $strUrl);
                 }
             }
         }
     }
     return $arrPages;
 }
開發者ID:contao,項目名稱:news-bundle,代碼行數:66,代碼來源:News.php

示例3: getSearchablePages

 /**
  * Add news items to the indexer
  * @param array
  * @param integer
  * @param boolean
  * @return array
  */
 public function getSearchablePages($arrPages, $intRoot = 0, $blnIsSitemap = false)
 {
     $arrRoot = array();
     if ($intRoot > 0) {
         $arrRoot = $this->Database->getChildRecords($intRoot, 'tl_page');
     }
     $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])) {
                 $domain = \Environment::get('base');
                 $objParent = $this->getPageDetails($objArchive->jumpTo);
                 // The target page does not exist
                 if ($objParent === null) {
                     continue;
                 }
                 if ($objParent->domain != '') {
                     $domain = (\Environment::get('ssl') ? 'https://' : 'http://') . $objParent->domain . TL_PATH . '/';
                 }
                 $arrProcessed[$objArchive->jumpTo] = $domain . $this->generateFrontendUrl($objParent->row(), $GLOBALS['TL_CONFIG']['useAutoItem'] ? '/%s' : '/items/%s', $objParent->language);
             }
             $strUrl = $arrProcessed[$objArchive->jumpTo];
             // Get the items
             $objArticle = \NewsModel::findPublishedDefaultByPid($objArchive->id);
             if ($objArticle !== null) {
                 while ($objArticle->next()) {
                     $arrPages[] = $this->getLink($objArticle, $strUrl);
                 }
             }
         }
     }
     return $arrPages;
 }
開發者ID:rburch,項目名稱:core,代碼行數:52,代碼來源:News.php


注:本文中的NewsModel::findPublishedDefaultByPid方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。