|
TYPO3 API
SVNRelease
|
00001 <?php 00002 /* * 00003 * This script belongs to the FLOW3 package "Fluid". * 00004 * * 00005 * It is free software; you can redistribute it and/or modify it under * 00006 * the terms of the GNU Lesser General Public License as published by the * 00007 * Free Software Foundation, either version 3 of the License, or (at your * 00008 * option) any later version. * 00009 * * 00010 * This script is distributed in the hope that it will be useful, but * 00011 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN- * 00012 * TABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser * 00013 * General Public License for more details. * 00014 * * 00015 * You should have received a copy of the GNU Lesser General Public * 00016 * License along with the script. * 00017 * If not, see http://www.gnu.org/licenses/lgpl.html * 00018 * * 00019 * The TYPO3 project - inspiring people to share! * 00020 * */ 00021 00022 /** 00023 * View helper which returns the current page path as known from TYPO3 backend modules 00024 * Note: This view helper is experimental! 00025 * 00026 * = Examples = 00027 * 00028 * <code> 00029 * <f:be.pagePath /> 00030 * </code> 00031 * <output> 00032 * Current page path, prefixed with "Path:" and wrapped in a span with the class "typo3-docheader-pagePath" 00033 * </output> 00034 * 00035 * @author Steffen Kamper <info@sk-typo3.de> 00036 * @author Bastian Waidelich <bastian@typo3.org> 00037 * @license http://www.gnu.org/copyleft/gpl.html 00038 */ 00039 class Tx_Fluid_ViewHelpers_Be_PagePathViewHelper extends Tx_Fluid_ViewHelpers_Be_AbstractBackendViewHelper { 00040 00041 00042 /** 00043 * Renders the current page path 00044 * 00045 * @return string the rendered page path 00046 * @see template::getPagePath() Note: can't call this method as it's protected! 00047 */ 00048 public function render() { 00049 $doc = $this->getDocInstance(); 00050 $id = t3lib_div::_GP('id'); 00051 $pageRecord = t3lib_BEfunc::readPageAccess($id, $GLOBALS['BE_USER']->getPagePermsClause(1)); 00052 00053 // Is this a real page 00054 if ($pageRecord['uid']) { 00055 $title = $pageRecord['_thePathFull']; 00056 } else { 00057 $title = $GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename']; 00058 } 00059 // Setting the path of the page 00060 $pagePath = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.path', 1) . ': <span class="typo3-docheader-pagePath">'; 00061 00062 // crop the title to title limit (or 50, if not defined) 00063 $cropLength = (empty($GLOBALS['BE_USER']->uc['titleLen'])) ? 50 : $GLOBALS['BE_USER']->uc['titleLen']; 00064 $croppedTitle = t3lib_div::fixed_lgd_cs($title, -$cropLength); 00065 if ($croppedTitle !== $title) { 00066 $pagePath .= '<abbr title="' . htmlspecialchars($title) . '">' . htmlspecialchars($croppedTitle) . '</abbr>'; 00067 } else { 00068 $pagePath .= htmlspecialchars($title); 00069 } 00070 $pagePath .= '</span>'; 00071 return $pagePath; 00072 } 00073 } 00074 ?>
1.8.0