本文整理汇总了PHP中PageModel::findOneBy方法的典型用法代码示例。如果您正苦于以下问题:PHP PageModel::findOneBy方法的具体用法?PHP PageModel::findOneBy怎么用?PHP PageModel::findOneBy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PageModel
的用法示例。
在下文中一共展示了PageModel::findOneBy方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addMarksaleScriptToDynamicScriptTags
/**
* @param string $strBuffer
* @return string
*/
public static function addMarksaleScriptToDynamicScriptTags($strBuffer)
{
if (TL_MODE == 'FE') {
/* @var $objPage \Contao\PageModel */
global $objPage;
$objParentPage = \PageModel::findOneBy(array('id=?', 'type=?'), array($objPage->rootId, 'root'));
$objTemplate = new \FrontendTemplate('marksale_default');
$objTemplate->mstcId = $objParentPage->mstcId;
$GLOBALS['TL_BODY'][] = $objTemplate->parse();
}
return $strBuffer;
}
示例2: compile
/**
* Generate module
*/
protected function compile()
{
global $objPage;
$this->Template->imagepath = '';
$objCoverPicture = \ModuleCoverpictureModel::findOneBy('jumpTo', $objPage->id);
if ($objCoverPicture->singleSRC == '') {
//get parent page
$objParentPage = \PageModel::findOneBy('id', $objPage->id);
while (($objCoverPicture->singleSRC == '' || $objCoverPicture->no_inheritance == 1) && $objParentPage->type != 'root') {
$objCoverPicture = \ModuleCoverpictureModel::findOneBy('jumpTo', $objParentPage->id);
// next parent ...
if ($objParentPage->pid) {
$objParentPage = \PageModel::findOneBy('id', $objParentPage->pid);
$objCoverPicture = \ModuleCoverpictureModel::findOneBy('jumpTo', $objParentPage->id);
}
}
}
// no Picture found -> default
if (!$objCoverPicture) {
$objCoverPicture = \ModuleCoverpictureModel::findByStandard(1);
}
$objFile = $this->getCoverpictureImageObjFile($objCoverPicture->singleSRC);
if ($objFile === null || !is_file(TL_ROOT . '/' . $objFile->path)) {
$this->Template->imagepath = '';
}
// Use as background image
if ($objCoverPicture->use_as_background == false) {
$this->Template->imagepath = $objFile->path;
// Resize image
if ($objCoverPicture->resize_image) {
$size = deserialize($objCoverPicture->size);
$this->Template->imagepath = $this->getImage($this->urlEncode($objFile->path), $size[0], $size[1], $size[2]);
}
// Image map (thanks to Felix Pfeiffer)
if ($objCoverPicture->imageMap != "") {
$imgMapID = uniqid('imap_');
$this->Template->imgMapID = $imgMapID;
$text = '<map name="%s" id="%s">%s</map>';
$this->Template->imgMap = sprintf($text, $imgMapID, $imgMapID, $objCoverPicture->imageMap);
}
$this->Template->pagetitle = $objPage->pageTitle;
} else {
$this->Template->use_as_background = true;
$this->generateBackgroundImage($objCoverPicture);
}
}
示例3: addFileMetaInformationToRequest
/**
* Add the file meta information to the request
*
* @param string $strUuid
* @param string $strPtable
* @param integer $intPid
*/
public static function addFileMetaInformationToRequest($strUuid, $strPtable, $intPid)
{
$objFile = \FilesModel::findByUuid($strUuid);
if ($objFile === null) {
return;
}
$arrMeta = deserialize($objFile->meta);
if (empty($arrMeta)) {
return;
}
$objPage = null;
switch ($strPtable) {
case 'tl_article':
$objPage = \PageModel::findOneBy(array('tl_page.id=(SELECT pid FROM tl_article WHERE id=?)'), $intPid);
break;
case 'tl_news':
$objPage = \PageModel::findOneBy(array('tl_page.id=(SELECT jumpTo FROM tl_news_archive WHERE id=(SELECT pid FROM tl_news WHERE id=?))'), $intPid);
break;
case 'tl_news_archive':
$objPage = \PageModel::findOneBy(array('tl_page.id=(SELECT jumpTo FROM tl_news_archive WHERE id=?)'), $intPid);
break;
case 'tl_calendar_events':
$objPage = \PageModel::findOneBy(array('tl_page.id=(SELECT jumpTo FROM tl_calendar WHERE id=(SELECT pid FROM tl_calendar_events WHERE id=?))'), $intPid);
break;
case 'tl_calendar':
$objPage = \PageModel::findOneBy(array('tl_page.id=(SELECT jumpTo FROM tl_calendar WHERE id=?)'), $intPid);
break;
case 'tl_faq_category':
$objPage = \PageModel::findOneBy(array('tl_page.id=(SELECT jumpTo FROM tl_faq_category WHERE id=?)'), $intPid);
break;
default:
// HOOK: support custom modules
if (isset($GLOBALS['TL_HOOKS']['addFileMetaInformationToRequest']) && is_array($GLOBALS['TL_HOOKS']['addFileMetaInformationToRequest'])) {
foreach ($GLOBALS['TL_HOOKS']['addFileMetaInformationToRequest'] as $callback) {
if (($val = \System::importStatic($callback[0])->{$callback[1]}($strPtable, $intPid)) !== false) {
$objPage = $val;
}
}
if ($objPage instanceof \Database\Result && $objPage->numRows < 1) {
return;
}
if (is_object($objPage) && !$objPage instanceof \PageModel) {
$objPage = \PageModel::findByPk($objPage->id);
}
}
break;
}
if ($objPage === null) {
return;
}
$objPage->loadDetails();
// Convert the language to a locale (see #5678)
$strLanguage = str_replace('-', '_', $objPage->rootLanguage);
if (isset($arrMeta[$strLanguage])) {
if (\Input::post('alt') == '' && !empty($arrMeta[$strLanguage]['title'])) {
\Input::setPost('alt', $arrMeta[$strLanguage]['title']);
}
if (\Input::post('caption') == '' && !empty($arrMeta[$strLanguage]['caption'])) {
\Input::setPost('caption', $arrMeta[$strLanguage]['caption']);
}
}
}
示例4: findParentWithSettings
protected function findParentWithSettings(\PageModel $objPage, $property = null)
{
if ($objPage->type === 'root') {
$objPage->pam = $objPage->pam_root;
$objPage->paSpeed = $objPage->paRootSpeed;
$objPage->paTimeout = $objPage->paRootTimeout;
}
if ($property) {
if ($objPage->{$property} != '') {
return $objPage;
}
}
if ($objPage->paSpeed && $objPage->paTimeout && $objPage->sortBy != '') {
return $objPage;
}
if (!$objPage->pid) {
return null;
}
return $this->findParentWithSettings(\PageModel::findOneBy('id', $objPage->pid), $property);
}
示例5: getHomepageUrl
public static function getHomepageUrl()
{
$strLanguage = $GLOBALS['TL_LANGUAGE'];
$objRootPage = \PageModel::findOneBy(array('type', 'language'), array('root', $strLanguage));
if ($objRootPage) {
$objHomePage = \PageModel::findFirstPublishedRegularByPid($objRootPage->id);
if ($objHomePage) {
return \Controller::generateFrontendUrl($objHomePage->row());
} else {
$homepageUrl = array('de' => 'startseite.html', 'en' => 'home.html');
return $homepageUrl[$strLanguage];
}
}
return false;
}