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


PHP ContentObjectRenderer::keywords方法代码示例

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


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

示例1: makeMenu


//.........这里部分代码省略.........
                     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';
                     }
                     // Get
                     $extraWhere = ($this->conf['includeNotInMenu'] ? '' : ' AND pages.nav_hide=0') . $this->getDoktypeExcludeWhere();
                     if ($this->conf['special.']['excludeNoSearchPages']) {
                         $extraWhere .= ' AND pages.no_search=0';
                     }
                     if ($maxAge > 0) {
                         $extraWhere .= ' AND ' . $sortField . '>' . ($GLOBALS['SIM_ACCESS_TIME'] - $maxAge);
                     }
                     $res = $this->parent_cObj->exec_getQuery('pages', array('pidInList' => '0', 'uidInList' => $id_list, 'where' => $sortField . '>=0' . $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 'keywords':
                     list($value) = GeneralUtility::intExplode(',', $value);
                     if (!$value) {
                         $value = $GLOBALS['TSFE']->page['uid'];
                     }
                     if ($this->conf['special.']['setKeywords'] || $this->conf['special.']['setKeywords.']) {
                         $kw = isset($this->conf['special.']['setKeywords.']) ? $this->parent_cObj->stdWrap($this->conf['special.']['setKeywords'], $this->conf['special.']['setKeywords.']) : $this->conf['special.']['setKeywords'];
                     } else {
                         // The page record of the 'value'.
                         $value_rec = $this->sys_page->getPage($value);
                         $kfieldSrc = $this->conf['special.']['keywordsField.']['sourceField'] ? $this->conf['special.']['keywordsField.']['sourceField'] : 'keywords';
                         // keywords.
                         $kw = trim($this->parent_cObj->keywords($value_rec[$kfieldSrc]));
                     }
                     // *'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';
                     }
开发者ID:rob-ot-dot-be,项目名称:ggallkeysecurity,代码行数:67,代码来源:AbstractMenuContentObject.php

示例2: prepareMenuItemsForKeywordsMenu

 /**
  * Fetches all menuitems if special = keywords is set
  *
  * @param string $specialValue The value from special.value
  * @param string $sortingField The sorting field
  * @return array
  */
 protected function prepareMenuItemsForKeywordsMenu($specialValue, $sortingField)
 {
     $tsfe = $this->getTypoScriptFrontendController();
     $menuItems = array();
     list($specialValue) = GeneralUtility::intExplode(',', $specialValue);
     if (!$specialValue) {
         $specialValue = $tsfe->page['uid'];
     }
     if ($this->conf['special.']['setKeywords'] || $this->conf['special.']['setKeywords.']) {
         $kw = isset($this->conf['special.']['setKeywords.']) ? $this->parent_cObj->stdWrap($this->conf['special.']['setKeywords'], $this->conf['special.']['setKeywords.']) : $this->conf['special.']['setKeywords'];
     } else {
         // The page record of the 'value'.
         $value_rec = $this->sys_page->getPage($specialValue);
         $kfieldSrc = $this->conf['special.']['keywordsField.']['sourceField'] ? $this->conf['special.']['keywordsField.']['sourceField'] : 'keywords';
         // keywords.
         $kw = trim($this->parent_cObj->keywords($value_rec[$kfieldSrc]));
     }
     // *'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<>' . $specialValue . ($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);
         $keyWordsWhereArr = array();
         foreach ($kwArr as $word) {
             $word = trim($word);
             if ($word) {
                 $keyWordsWhereArr[] = $kfield . ' LIKE \'%' . $this->getDatabaseConnection()->quoteStr($word, 'pages') . '%\'';
             }
         }
         $where = empty($keyWordsWhereArr) ? '' : '(' . implode(' OR ', $keyWordsWhereArr) . ')';
         $res = $this->parent_cObj->exec_getQuery('pages', array('pidInList' => '0', 'uidInList' => $id_list, 'where' => $where . $extraWhere, 'orderBy' => $sortingField ?: $sortField . ' desc', 'max' => $limit));
         while ($row = $this->getDatabaseConnection()->sql_fetch_assoc($res)) {
             $tsfe->sys_page->versionOL('pages', $row, true);
             if (is_array($row)) {
                 $menuItems[$row['uid']] = $this->sys_page->getPageOverlay($row);
             }
         }
         $this->getDatabaseConnection()->sql_free_result($res);
     }
     return $menuItems;
 }
开发者ID:vip3out,项目名称:TYPO3.CMS,代码行数:87,代码来源:AbstractMenuContentObject.php


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