[TYPO3-core] RFC: feature #1520 patch

Wolfgang Klinger wolfgang at stufenlos.net
Sun Feb 26 16:26:54 CET 2006


 *hiya!*

 Type: feature

 Allow to exclude the current page in HMENU / excludeUidList
 BT reference: http://bugs.typo3.org/view.php?id=1520

 Here's a patch.
 I think the same can be achieved with 'doNotShowLink', so please think
 about it and decide if it's useful enough
 (e.g. you can easily create a 'other pages on this level' menu).


 bye
 Wolfgang

-------------- next part --------------
--- TYPO3core/typo3/sysext/cms/tslib/class.tslib_menu.php	2006-02-26 11:23:45.000000000 +0100
+++ TYPO3core_testing/typo3/sysext/cms/tslib/class.tslib_menu.php	2006-02-26 16:07:32.000000000 +0100
@@ -789,10 +789,7 @@
 			$maxItems = intval($this->mconf['maxItems'] ? $this->mconf['maxItems'] : $this->conf['maxItems']);
 			$begin = tslib_cObj::calc($this->mconf['begin'] ? $this->mconf['begin'] : $this->conf['begin']);
 
-			$banUidArray=array();
-			if (trim($this->conf['excludeUidList']))	{
-				$banUidArray = t3lib_div::intExplode(',', $this->conf['excludeUidList']);
-			}
+			$banUidArray = $this->getBannedUids();
 
 				// Fill in the menuArr with elements that should go into the menu:
 			$this->menuArr = Array();
@@ -1476,6 +1473,23 @@
 		return $this->doktypeExcludeList ? ' AND pages.doktype NOT IN ('.$this->doktypeExcludeList.')' : '';
 	}
 
+	/**
+	 * Returns an array of banned UIDs (from excludeUidList)
+	 *
+	 * @return	array 		Array of banned UIDs
+	 * @access private
+	 */
+	function getBannedUids() {
+		$banUidArray = array();
+
+		if (trim($this->conf['excludeUidList']))	{
+			$banUidList = preg_replace('/current(page)?/i', $GLOBALS['TSFE']->page['uid'], $this->conf['excludeUidList']);
+			$banUidArray = t3lib_div::intExplode(',', $banUidList);
+		}
+
+		return $banUidArray;
+	}
+
 }
 
 
@@ -2712,10 +2726,7 @@
 		$MP_params = $MP_var ? '&MP='.rawurlencode($MP_var) : '';
 
 			// UIDs to ban:
-		$banUidArray=array();
-		if (trim($this->conf['excludeUidList']))	{
-			$banUidArray = t3lib_div::intExplode(',', $this->conf['excludeUidList']);
-		}
+		$banUidArray = $this->getBannedUids();
 
 			// Initializing variables:
 		$var = $this->JSVarName;


More information about the TYPO3-team-core mailing list