本文整理汇总了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();
}
示例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();
}
示例3: renderArticle
protected function renderArticle($objChild)
{
$objArticles = \ArticleModel::findPublishedById($objChild->articleAlias);
if ($objArticles === null) {
return '';
}
if (!\Controller::isVisibleElement($objArticles)) {
return '';
}
return \Controller::getArticle($objArticles);
}
示例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;
}
示例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;
}