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


PHP ArticleModel::findPublishedById方法代码示例

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


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

示例1: generate

 /**
  * Check whether the target page and article are published
  * @return string
  */
 public function generate()
 {
     $objArticle = \ArticleModel::findPublishedById($this->article);
     if ($objArticle === null) {
         return '';
     }
     $objPage = $objArticle->getPage();
     if ($objPage === null) {
         return '';
     }
     $objArticle->pid = $objPage;
     $this->objArticle = $objArticle;
     return parent::generate();
 }
开发者ID:rikaix,项目名称:core,代码行数:18,代码来源:ContentTeaser.php

示例2: generate

 /**
  * Check whether the target page and the article are published
  *
  * @return string
  */
 public function generate()
 {
     $objArticle = \ArticleModel::findPublishedById($this->article);
     if ($objArticle === null) {
         return '';
     }
     // Use findPublished() instead of getRelated()
     $objParent = \PageModel::findPublishedById($objArticle->pid);
     if ($objParent === null) {
         return '';
     }
     $this->objArticle = $objArticle;
     $this->objParent = $objParent;
     return parent::generate();
 }
开发者ID:juergen83,项目名称:contao,代码行数:20,代码来源:ContentTeaser.php

示例3: renderArticle

 protected function renderArticle($objChild)
 {
     $objArticles = \ArticleModel::findPublishedById($objChild->articleAlias);
     if ($objArticles === null) {
         return '';
     }
     if (!\Controller::isVisibleElement($objArticles)) {
         return '';
     }
     return \Controller::getArticle($objArticles);
 }
开发者ID:heimrichhannot,项目名称:contao-blocks,代码行数:11,代码来源:ModuleBlock.php

示例4: handleArticle

 /**
  * Handle articles
  * @return bool return true, or false if the articles does not exist
  */
 protected function handleArticle()
 {
     if (($objArticle = \ArticleModel::findPublishedById($this->articleId, array('eager' => true))) === null) {
         return false;
     }
     if (($objTarget = \PageModel::findPublishedById($objArticle->pid)) === null) {
         return false;
     }
     $objTarget = $objTarget->loadDetails();
     if ($objTarget->domain != '' && $objTarget->domain != \Environment::get('host')) {
         $this->target = true;
     }
     $strParams = '/articles/' . (!\Config::get('disableAlias') && $objArticle->alias != '' ? $objArticle->alias : $objArticle->id);
     $this->setHref(ampersand(\Controller::generateFrontendUrl($objTarget->row(), $strParams, null, $this->target)));
     $this->setTitle(sprintf($GLOBALS['TL_LANG']['MSC']['linkteaser']['articleTitle'], $objArticle->title));
     $this->setLink(sprintf($this->getLink(), $objArticle->title));
     return true;
 }
开发者ID:heimrichhannot,项目名称:contao-teaser,代码行数:22,代码来源:ContentLinkTeaser.php

示例5: findRelatedByCredit

 public function findRelatedByCredit($objCredit, $arrPids)
 {
     $this->result = $objCredit;
     $objFile = \FilesModel::findByPk($objCredit->id);
     if ($objFile === null) {
         return null;
     }
     $this->file = $objFile;
     switch ($objCredit->ptable) {
         case 'tl_article':
             $objArticle = \ArticleModel::findPublishedById($objCredit->parent);
             if ($objArticle === null) {
                 return null;
             }
             $this->parent = $objArticle;
             $objJumpTo = $objArticle->getRelated('pid');
             if ($objJumpTo == null) {
                 return null;
             }
             if (!in_array($objJumpTo->id, $arrPids)) {
                 return null;
             }
             $this->page = $objJumpTo;
             break;
         case 'tl_news':
             $objNews = \NewsModel::findByPk($objCredit->parent);
             if ($objNews === null) {
                 return null;
             }
             $this->parent = $objNews->current();
             $objNewsArchive = \NewsArchiveModel::findByPk($objNews->pid);
             $objJumpTo = \PageModel::findPublishedById($objNewsArchive->jumpTo);
             if ($objJumpTo == null) {
                 return null;
             }
             if (!in_array($objJumpTo->id, $arrPids)) {
                 return null;
             }
             $this->page = $objJumpTo;
             break;
         default:
             $this->parent = null;
             $this->page = null;
             // TODO refactor
             if (isset($GLOBALS['TL_FILECREDIT_MODELS'][$objCredit->ptable])) {
                 $strClass = $GLOBALS['TL_MODELS'][$objCredit->ptable];
                 if (!$this->classFileExists($strClass)) {
                     return null;
                 }
                 $this->loadDataContainer($objCredit->ptable);
                 $archiveTable = $GLOBALS['TL_DCA'][$objCredit->ptable]['config']['ptable'];
                 if (!$archiveTable || !isset($GLOBALS['TL_MODELS'][$archiveTable])) {
                     return null;
                 }
                 $strArchiveClass = $GLOBALS['TL_MODELS'][$archiveTable];
                 if (!$this->classFileExists($strArchiveClass)) {
                     return null;
                 }
                 $objItem = $strClass::findByPk($objCredit->parent);
                 if ($objItem === null) {
                     return null;
                 }
                 $this->parent = $objItem->current();
                 $objItemArchive = $strArchiveClass::findByPk($objItem->pid);
                 $objJumpTo = \PageModel::findPublishedById($objItemArchive->jumpTo);
                 if ($objJumpTo == null) {
                     return null;
                 }
                 if (!in_array($objJumpTo->id, $arrPids)) {
                     return null;
                 }
                 $this->page = $objJumpTo;
             }
     }
     return $this;
 }
开发者ID:pandroid,项目名称:contao-filecredits,代码行数:76,代码来源:FileCreditHybridModel.php


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