本文整理汇总了PHP中ArticleModel::findOneBy方法的典型用法代码示例。如果您正苦于以下问题:PHP ArticleModel::findOneBy方法的具体用法?PHP ArticleModel::findOneBy怎么用?PHP ArticleModel::findOneBy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ArticleModel
的用法示例。
在下文中一共展示了ArticleModel::findOneBy方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getArticleLabel
public function getArticleLabel($row, $label)
{
$page = \PageModel::findWithDetails($row['pid']);
$layout = $page->getRelated('layout');
$callback = $GLOBALS['TL_DCA']['tl_article']['list']['label']['reveal_original_label_callback'];
if (is_array($callback)) {
$callback[0] = \System::importStatic($callback[0]);
}
$label = call_user_func($callback, $row, $label);
if ($layout->useRevealJs) {
if ($row['revealVerticalSlide'] == 'start') {
$label = '┬ ' . $label;
} else {
if ($row['revealVerticalSlide'] == 'stop') {
$label = '┴ ' . $label;
} else {
$predecessors = \ArticleModel::findBy(array('pid = ?', 'sorting < ?', 'revealVerticalSlide != ?'), array($row['pid'], $row['sorting'], ''), array('order' => 'sorting DESC', 'limit' => 1));
if ($predecessors && $predecessors->revealVerticalSlide == 'start') {
$successor = \ArticleModel::findOneBy(array('pid = ?', 'sorting > ?'), array($row['pid'], $row['sorting']), array('order' => 'sorting', 'limit' => 1));
if ($successor && $successor->revealVerticalSlide == 'start') {
$label = '┴ ' . $label;
} else {
$label = '│ ' . $label;
}
}
}
}
$predecessors = \ArticleModel::findBy(array('pid = ?', 'sorting < ?'), array($row['pid'], $row['sorting']), array('order' => 'sorting'));
if ($predecessors) {
$slide = $predecessors->count();
$page = -1;
$inVertical = false;
foreach ($predecessors as $predecessor) {
if ($predecessor->revealVerticalSlide == 'start') {
$inVertical = true;
}
if ($inVertical && $predecessor->revealVerticalSlide != 'start') {
$page += 0.001;
} else {
$page = (int) ($page + 1);
}
if ($predecessor->revealVerticalSlide == 'stop') {
$inVertical = false;
}
}
if ($inVertical && $row['revealVerticalSlide'] != 'start') {
$page += 0.001;
} else {
$page = (int) ($page + 1);
}
if ($inVertical) {
$pageMain = (int) $page;
$pageSub = (int) (($page - $pageMain) * 1000);
$page = sprintf('%d-%d', $pageMain, $pageSub);
} else {
$page = (int) $page;
}
} else {
$slide = 0;
$page = 0;
}
$label .= ' ' . sprintf($GLOBALS['TL_LANG']['tl_article']['revealSlideNumber'], $slide, $page);
}
return $label;
}
示例2: replaceCustomizeInsertTags
//.........这里部分代码省略.........
$imgSize = ' ' . $imgSize[3];
}
$strReturn = \Image::getHtml($src, \Config::get('dps_website' . $namePrefix . 'Alt'), $imgSize);
// Image link
$imageUrl = \Config::get('dps_website' . $namePrefix . 'ImageUrl');
if ($imageUrl != '' && TL_MODE == 'FE') {
$attributes = "";
if (\Config::get('dps_website' . $namePrefix . 'ImageNewWindow')) {
$attributes = $objPage->outputFormat == 'xhtml' ? ' onclick="return !window.open(this.href)"' : ' target="_blank"';
}
$strReturn = '<a href="' . $imageUrl . '"' . $attributes . '>' . $strReturn . '</a>';
}
$strReturn = $this->replaceInsertTags($strReturn);
}
}
}
}
if (strlen($strReturn)) {
$return = $strReturn;
}
break;
case "platzhalter":
case "insert":
case "placeholder":
$return = \DPS\Customize\Frontend\Module\Placeholder::getPlaceholder($arrSplit[2]);
// Replace TL_JAVASCRIPT from other modules before!
Helper::replaceOtherDefaultScripts();
Helper::checkForUniqueScripts();
break;
case "article":
switch ($arrSplit[2]) {
case "topImage":
case "imageTop":
$objArticle = \ArticleModel::findOneBy(array('pid=?', 'inColumn=?'), array($objPage->id, "main"));
if ($objArticle) {
if (!$objArticle->addTopImage) {
$objParentPage = \PageModel::findByPk($objPage->pid);
if ($objParentPage) {
$objArticle = \ArticleModel::findOneBy(array('pid=?', 'inColumn=?'), array($objParentPage->id, "main"));
}
}
if ($objArticle->addTopImage) {
$imageSRC = $objArticle->topImageSRC;
$objFile = \FilesModel::findByUuid($imageSRC);
if ($objFile === null) {
if (!\Validator::isUuid($imageSRC)) {
$strReturn = '<p class="error">' . $GLOBALS['TL_LANG']['ERR']['version2format'] . '</p>';
}
}
if (is_file(TL_ROOT . '/' . $objFile->path)) {
$singleSRC = $objFile->path;
$imgSize = getimagesize(TL_ROOT . '/' . $singleSRC);
// $intMaxWidth = \Config::get( 'maxImageWidth' );
// $src = \Image::get($singleSRC, $imgSize[0], $imgSize[1], 'center_center');
$src = \Image::get($singleSRC, 1050, 422, 'center_center');
// Image dimensions
if (($imgSize = @getimagesize(TL_ROOT . '/' . rawurldecode($src))) !== false) {
$arrSize = $imgSize;
$imgSize = ' ' . $imgSize[3];
}
$return = \Image::getHtml($src, '', $imgSize);
// Image link
// $imageUrl = \Config::get('dps_website' . $namePrefix . 'ImageUrl');
//
// if ($imageUrl != '' && TL_MODE == 'FE')
// {