[ Index ] |
|
Code source de Typo3 4.1.3 |
1 <?php 2 /*************************************************************** 3 * Copyright notice 4 * 5 * (c) 1999-2005 Kasper Skaarhoj (kasperYYYY@typo3.com) 6 * All rights reserved 7 * 8 * This script is part of the TYPO3 project. The TYPO3 project is 9 * free software; you can redistribute it and/or modify 10 * it under the terms of the GNU General Public License as published by 11 * the Free Software Foundation; either version 2 of the License, or 12 * (at your option) any later version. 13 * 14 * The GNU General Public License can be found at 15 * http://www.gnu.org/copyleft/gpl.html. 16 * A copy is found in the textfile GPL.txt and important notices to the license 17 * from the author is found in LICENSE.txt distributed with these scripts. 18 * 19 * 20 * This script is distributed in the hope that it will be useful, 21 * but WITHOUT ANY WARRANTY; without even the implied warranty of 22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 23 * GNU General Public License for more details. 24 * 25 * This copyright notice MUST APPEAR in all copies of the script! 26 ***************************************************************/ 27 /** 28 * This is an example of how to manipulate menu item arrays. 29 * Used in the "testsite" package 30 * 31 * $Id: example_itemArrayProcFunc.php 639 2005-04-13 23:12:04Z mundaun $ 32 * Revised for TYPO3 3.6 June/2003 by Kasper Skaarhoj 33 * XHTML compliant 34 * 35 * @author Kasper Skaarhoj <kasperYYYY@typo3.com> 36 */ 37 38 39 40 41 42 43 44 45 46 47 /** 48 * This function basically adds the parent page to the sublevel but only if the sublevel is empty! 49 * It is also used to demonstrate the menu state items 50 * 51 * Example can be found in the testsite package at the page-path "/Intro/TypoScript examples/Menu object examples/Fake menu items/" and "/Intro/TypoScript examples/Menu object examples/Menu state test/" 52 * This TypoScript configuration will also demonstrate it ("fake menu items"): 53 * 54 * includeLibs.fakemenuitems = media/scripts/example_itemArrayProcFunc.php 55 * page = PAGE 56 * page.10 = HMENU 57 * page.10.1 = TMENU 58 * page.10.1.expAll = 1 59 * page.10.1.NO { 60 * allWrap = | <br /> 61 * linkWrap = <b>|</b> 62 * } 63 * page.10.2 = TMENU 64 * page.10.2.itemArrayProcFunc = user_itemArrayProcFuncTest 65 * page.10.2.NO { 66 * allWrap = | <br /> 67 * linkWrap = <b> - |</b> 68 * } 69 * 70 * @param array The $menuArr array which simply is a num-array of page records which goes into the menu. 71 * @param array TypoScript configuration for the function. Notice that the property "parentObj" is a reference to the parent (calling) object (the tslib_Xmenu class instantiated) 72 * @return array The modified $menuArr array 73 */ 74 function user_itemArrayProcFuncTest($menuArr,$conf) { 75 if ($conf['demoItemStates']) { // Used in the example of item states 76 reset($menuArr); 77 $c=0; 78 $teststates=explode(',','NO,ACT,IFSUB,CUR,USR,SPC,USERDEF1,USERDEF2'); 79 while(list($k,$v)=each($menuArr)) { 80 $menuArr[$k]['ITEM_STATE']=$teststates[$c]; 81 $menuArr[$k]['title'].= ($teststates[$c] ? ' ['.$teststates[$c].']' : ''); 82 $c++; 83 } 84 } else { // used in the fake menu item example! 85 if (!count($menuArr)) { // There must be no menu items if we add the parent page to the submenu: 86 $parentPageId = $conf['parentObj']->id; // id of the parent page 87 $parentPageRow = $GLOBALS['TSFE']->sys_page->getPage($parentPageId); // ... and get the record... 88 if (is_array($parentPageRow)) { // ... and if that page existed (a row was returned) then add it! 89 $menuArr[]=$parentPageRow; 90 } 91 } 92 } 93 return $menuArr; 94 } 95 96 /** 97 * Used in the menu item state example of the "testsite" package at page-path "/Intro/TypoScript examples/Menu object examples/Menu state test/" 98 * 99 * @param array The menu item array, $this->I (in the parent object) 100 * @param array TypoScript configuration for the function. Notice that the property "parentObj" is a reference to the parent (calling) object (the tslib_Xmenu class instantiated) 101 * @return array The processed $I array returned (and stored in $this->I of the parent object again) 102 * @see tslib_menu::userProcess(), tslib_tmenu::writeMenu(), tslib_gmenu::writeMenu() 103 */ 104 function user_IProcFuncTest($I,$conf) { 105 $itemRow = $conf['parentObj']->menuArr[$I['key']]; 106 107 // Setting the document status content to the value of the page title on mouse over 108 $I['linkHREF']['onMouseover'].='extraRollover(\''.rawurlencode($itemRow['title']).'\');'; 109 $conf['parentObj']->I = $I; 110 $conf['parentObj']->setATagParts(); 111 $I = $conf['parentObj']->I; 112 if ($I['parts']['ATag_begin']) $I['parts']['ATag_begin']=$I['A1']; 113 114 if ($conf['debug']) { 115 // Outputting for debug example: 116 echo 'ITEM: <h2>'.htmlspecialchars($itemRow['uid'].': '.$itemRow['title']).'</h2>'; 117 t3lib_div::debug($itemRow); 118 t3lib_div::debug($I); 119 echo '<hr />'; 120 } 121 // Returns: 122 return $I; 123 } 124 125 126 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Sun Nov 25 17:13:16 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |