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


PHP ContentObjectRenderer::typolink方法代码示例

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


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

示例1: renderLinktypeFile

 /**
  * Render link of type file
  *
  * @param array $lConf
  * @return array
  */
 private function renderLinktypeFile($lConf)
 {
     $viewAssign = array();
     // Get file
     $fileRepository = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Resource\\FileRepository');
     $fileObjects = $fileRepository->findByRelation('tt_content', 'mfp_image', $this->data['uid']);
     /** @var \TYPO3\CMS\Core\Resource\File $file */
     $file = $fileObjects[0];
     if (!empty($file)) {
         // Configure the image
         $this->cObj->setCurrentFile($file);
         $imageConf = $GLOBALS['TSFE']->tmpl->setup['lib.']['tx_jhmagnificpopup_pi1.']['image.'];
         $imageConf['file.']['treatIdAsReference'] = 1;
         $imageConf['file'] = $file;
         if (!empty($this->settings['mfpOption']['file_width'])) {
             $imageConf["file."]["maxW"] = $this->settings['mfpOption']['file_width'];
         }
         if (!empty($this->settings['mfpOption']['file_height'])) {
             $imageConf["file."]["maxH"] = $this->settings['mfpOption']['file_height'];
         }
         // Render image
         $theImgCode = $this->cObj->IMAGE($imageConf);
         // Get image orientation
         switch ($this->settings['mfpOption']['file_orient']) {
             case 1:
                 $viewAssign['imageorient'] = 'right';
                 break;
             case 2:
                 $viewAssign['imageorient'] = 'left';
                 break;
             case 0:
             default:
                 $viewAssign['imageorient'] = 'center';
         }
         // Get image description/caption
         $viewAssign['imagecaption'] = $file->getProperty('description');
         // Render typolink
         $viewAssign['tsLink'] = $this->cObj->typolink($theImgCode, $lConf);
     } else {
         $this->addFlashMessage('Please select an image', 'No image', AbstractMessage::WARNING);
     }
     return $viewAssign;
 }
开发者ID:Ducrot,项目名称:ext-jh_magnificpopup,代码行数:49,代码来源:MagnificpopupController.php

示例2: getListContent

 /**
  * get the content for a news item NOT displayed as single item (List & Latest)
  *
  * @param	array		$itemparts : parts of the html template
  * @param	array		$selectConf : quety parameters in an array
  * @param	string		$prefix_display : the part of the TS-setup
  * @return	string		$itemsOut: itemlist as htmlcode
  */
 function getListContent($itemparts, $selectConf, $prefix_display)
 {
     if ($this->debugTimes) {
         $this->hObj->getParsetime(__METHOD__);
     }
     $limit = $this->config['limit'];
     $lConf = $this->conf[$prefix_display . '.'];
     $res = $this->exec_getQuery('tt_news', $selectConf);
     //get query for list contents
     //				debug($selectConf, $this->theCode.' final $selectConf (' . __CLASS__ . '::' . __FUNCTION__ . ')', __LINE__, __FILE__, 3);
     // make some final config manipulations
     // overwrite image sizes from TS with the values from content-element if they exist.
     if ($this->config['FFimgH'] || $this->config['FFimgW']) {
         $lConf['image.']['file.']['maxW'] = $this->config['FFimgW'];
         $lConf['image.']['file.']['maxH'] = $this->config['FFimgH'];
     }
     if ($this->config['croppingLenght']) {
         $lConf['subheader_stdWrap.']['crop'] = $this->config['croppingLenght'];
     }
     $this->splitLConf = array();
     $cropSuffix = FALSE;
     if ($this->conf['enableOptionSplit']) {
         if ($this->config['croppingLenghtOptionSplit']) {
             $crop = $lConf['subheader_stdWrap.']['crop'];
             if ($this->config['croppingLenght']) {
                 $crop = $this->config['croppingLenght'];
             }
             $cparts = explode('|', $crop);
             if (is_array($cparts)) {
                 $cropSuffix = '|' . $cparts[1] . ($cparts[2] ? '|' . $cparts[2] : '');
             }
             $lConf['subheader_stdWrap.']['crop'] = $this->config['croppingLenghtOptionSplit'];
         }
         $resCount = $this->db->sql_num_rows($res);
         $this->splitLConf = $this->processOptionSplit($lConf, $limit, $resCount);
     }
     $itemsOut = '';
     $itempartsCount = count($itemparts);
     $pTmp = $this->tsfe->ATagParams;
     $cc = 0;
     $piVarsArray = array('backPid' => $this->conf['dontUseBackPid'] ? null : $this->config['backPid'], 'year' => $this->conf['dontUseBackPid'] ? null : ($this->piVars['year'] ? $this->piVars['year'] : null), 'month' => $this->conf['dontUseBackPid'] ? null : ($this->piVars['month'] ? $this->piVars['month'] : null));
     // needed for external renderer
     $this->listData = array();
     // Getting elements
     while ($row = $this->db->sql_fetch_assoc($res)) {
         // gets the option splitted config for this record
         if ($this->conf['enableOptionSplit'] && !empty($this->splitLConf[$cc])) {
             $lConf = $this->splitLConf[$cc];
             $lConf['subheader_stdWrap.']['crop'] .= $cropSuffix;
         }
         $wrappedSubpartArray = array();
         $titleField = $lConf['linkTitleField'] ? $lConf['linkTitleField'] : '';
         // First get workspace/version overlay:
         if ($this->versioningEnabled) {
             $this->tsfe->sys_page->versionOL('tt_news', $row);
         }
         // Then get localization of record:
         if ($this->tsfe->sys_language_content) {
             // prevent link targets from being changed in localized records
             $tmpPage = $row['page'];
             $tmpExtURL = $row['ext_url'];
             $row = $this->tsfe->sys_page->getRecordOverlay('tt_news', $row, $this->tsfe->sys_language_content, $this->tsfe->sys_language_contentOL, '');
             $row['page'] = $tmpPage;
             $row['ext_url'] = $tmpExtURL;
         }
         // Register displayed news item globally:
         $GLOBALS['T3_VAR']['displayedNews'][] = $row['uid'];
         $this->tsfe->ATagParams = $pTmp . ' title="' . $this->local_cObj->stdWrap(trim(htmlspecialchars($row[$titleField])), $lConf['linkTitleField.']) . '"';
         if ($this->conf[$prefix_display . '.']['catOrderBy']) {
             $this->config['catOrderBy'] = $this->conf[$prefix_display . '.']['catOrderBy'];
         }
         //			if ($this->isRenderMarker('###NEWS_CATEGORY_ROOTLINE###')) {
         $this->categories = array();
         $this->categories[$row['uid']] = $this->getCategories($row['uid']);
         //			}
         $catSPid = FALSE;
         if ($row['type'] == 1 || $row['type'] == 2) {
             // News type article or external url
             $this->local_cObj->setCurrentVal($row['type'] == 1 ? $row['page'] : $row['ext_url']);
             $wrappedSubpartArray['###LINK_ITEM###'] = $this->local_cObj->typolinkWrap($this->conf['pageTypoLink.']);
             // fill the link string in a register to access it from TS
             $this->local_cObj->LOAD_REGISTER(array('newsMoreLink' => $this->local_cObj->typolink($this->pi_getLL('more'), $this->conf['pageTypoLink.'])), '');
         } else {
             //  Overwrite the singlePid from config-array with a singlePid given from the first entry in $this->categories
             if ($this->conf['useSPidFromCategory'] && is_array($this->categories)) {
                 $tmpcats = $this->categories;
                 if (is_array($tmpcats[$row['uid']])) {
                     $catSPid = array_shift($tmpcats[$row['uid']]);
                 }
             }
             $singlePid = $catSPid['single_pid'] ? $catSPid['single_pid'] : $this->config['singlePid'];
             $wrappedSubpartArray['###LINK_ITEM###'] = $this->getSingleViewLink($singlePid, $row, $piVarsArray);
//.........这里部分代码省略.........
开发者ID:mrmoree,项目名称:vkmh_typo3,代码行数:101,代码来源:class.tx_ttnews.php


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