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


PHP ContentObjectRenderer::getKey方法代码示例

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


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

示例1: prepareMenuItemsForRootlineMenu

 /**
  * Fetches all menuitems if special = rootline is set
  *
  * @return array
  */
 protected function prepareMenuItemsForRootlineMenu()
 {
     $menuItems = array();
     $range = isset($this->conf['special.']['range.']) ? $this->parent_cObj->stdWrap($this->conf['special.']['range'], $this->conf['special.']['range.']) : $this->conf['special.']['range'];
     $begin_end = explode('|', $range);
     $begin_end[0] = (int) $begin_end[0];
     if (!MathUtility::canBeInterpretedAsInteger($begin_end[1])) {
         $begin_end[1] = -1;
     }
     $beginKey = $this->parent_cObj->getKey($begin_end[0], $this->tmpl->rootLine);
     $endKey = $this->parent_cObj->getKey($begin_end[1], $this->tmpl->rootLine);
     if ($endKey < $beginKey) {
         $endKey = $beginKey;
     }
     $rl_MParray = array();
     foreach ($this->tmpl->rootLine as $k_rl => $v_rl) {
         // For overlaid mount points, set the variable right now:
         if ($v_rl['_MP_PARAM'] && $v_rl['_MOUNT_OL']) {
             $rl_MParray[] = $v_rl['_MP_PARAM'];
         }
         // Traverse rootline:
         if ($k_rl >= $beginKey && $k_rl <= $endKey) {
             $temp_key = $k_rl;
             $menuItems[$temp_key] = $this->sys_page->getPage($v_rl['uid']);
             if (!empty($menuItems[$temp_key])) {
                 // If there are no specific target for the page, put the level specific target on.
                 if (!$menuItems[$temp_key]['target']) {
                     $menuItems[$temp_key]['target'] = $this->conf['special.']['targets.'][$k_rl];
                     $menuItems[$temp_key]['_MP_PARAM'] = implode(',', $rl_MParray);
                 }
             } else {
                 unset($menuItems[$temp_key]);
             }
         }
         // For normal mount points, set the variable for next level.
         if ($v_rl['_MP_PARAM'] && !$v_rl['_MOUNT_OL']) {
             $rl_MParray[] = $v_rl['_MP_PARAM'];
         }
     }
     // Reverse order of elements (e.g. "1,2,3,4" gets "4,3,2,1"):
     if (isset($this->conf['special.']['reverseOrder']) && $this->conf['special.']['reverseOrder']) {
         $menuItems = array_reverse($menuItems);
     }
     return $menuItems;
 }
开发者ID:vip3out,项目名称:TYPO3.CMS,代码行数:50,代码来源:AbstractMenuContentObject.php

示例2: makeMenu


//.........这里部分代码省略.........
                     }
                     // *'auto', 'manual', 'tstamp'
                     $mode = $this->conf['special.']['mode'];
                     switch ($mode) {
                         case 'starttime':
                             $sortField = 'starttime';
                             break;
                         case 'lastUpdated':
                         case 'manual':
                             $sortField = 'lastUpdated';
                             break;
                         case 'tstamp':
                             $sortField = 'tstamp';
                             break;
                         case 'crdate':
                             $sortField = 'crdate';
                             break;
                         default:
                             $sortField = 'SYS_LASTCHANGED';
                     }
                     // Depth, limit, extra where
                     if (MathUtility::canBeInterpretedAsInteger($this->conf['special.']['depth'])) {
                         $depth = MathUtility::forceIntegerInRange($this->conf['special.']['depth'], 0, 20);
                     } else {
                         $depth = 20;
                     }
                     // Max number of items
                     $limit = MathUtility::forceIntegerInRange($this->conf['special.']['limit'], 0, 100);
                     $extraWhere = ' AND pages.uid<>' . $value . ($this->conf['includeNotInMenu'] ? '' : ' AND pages.nav_hide=0') . $this->getDoktypeExcludeWhere();
                     if ($this->conf['special.']['excludeNoSearchPages']) {
                         $extraWhere .= ' AND pages.no_search=0';
                     }
                     // Start point
                     $eLevel = $this->parent_cObj->getKey(isset($this->conf['special.']['entryLevel.']) ? $this->parent_cObj->stdWrap($this->conf['special.']['entryLevel'], $this->conf['special.']['entryLevel.']) : $this->conf['special.']['entryLevel'], $this->tmpl->rootLine);
                     $startUid = (int) $this->tmpl->rootLine[$eLevel]['uid'];
                     // Which field is for keywords
                     $kfield = 'keywords';
                     if ($this->conf['special.']['keywordsField']) {
                         list($kfield) = explode(' ', trim($this->conf['special.']['keywordsField']));
                     }
                     // If there are keywords and the startuid is present.
                     if ($kw && $startUid) {
                         $bA = MathUtility::forceIntegerInRange($this->conf['special.']['beginAtLevel'], 0, 100);
                         $id_list = $this->parent_cObj->getTreeList(-1 * $startUid, $depth - 1 + $bA, $bA - 1);
                         $kwArr = explode(',', $kw);
                         foreach ($kwArr as $word) {
                             $word = trim($word);
                             if ($word) {
                                 $keyWordsWhereArr[] = $kfield . ' LIKE \'%' . $GLOBALS['TYPO3_DB']->quoteStr($word, 'pages') . '%\'';
                             }
                         }
                         $res = $this->parent_cObj->exec_getQuery('pages', array('pidInList' => '0', 'uidInList' => $id_list, 'where' => '(' . implode(' OR ', $keyWordsWhereArr) . ')' . $extraWhere, 'orderBy' => $altSortFieldValue ? $altSortFieldValue : $sortField . ' desc', 'max' => $limit));
                         while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
                             $GLOBALS['TSFE']->sys_page->versionOL('pages', $row, TRUE);
                             if (is_array($row)) {
                                 $temp[$row['uid']] = $this->sys_page->getPageOverlay($row);
                             }
                         }
                     }
                     break;
                 case 'categories':
                     /** @var \TYPO3\CMS\Frontend\ContentObject\Menu\CategoryMenuUtility $categoryMenuUtility */
                     $categoryMenuUtility = GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\ContentObject\\Menu\\CategoryMenuUtility');
                     $temp = $categoryMenuUtility->collectPages($value, $this->conf['special.'], $this);
                     break;
                 case 'rootline':
开发者ID:rob-ot-dot-be,项目名称:ggallkeysecurity,代码行数:67,代码来源:AbstractMenuContentObject.php


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