Main Page | Directories | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages | Examples

example_itemArrayProcFunc.php File Reference

Go to the source code of this file.

Functions

 user_itemArrayProcFuncTest ($menuArr, $conf)
 This function basically adds the parent page to the sublevel but only if the sublevel is empty! It is also used to demonstrate the menu state items.
 user_IProcFuncTest ($I, $conf)
 Used in the menu item state example of the "testsite" package at page-path "/Intro/TypoScript examples/Menu object examples/Menu state test/".


Function Documentation

user_IProcFuncTest I,
conf
 

Used in the menu item state example of the "testsite" package at page-path "/Intro/TypoScript examples/Menu object examples/Menu state test/".

Parameters:
array The menu item array, $this->I (in the parent object)
array TypoScript configuration for the function. Notice that the property "parentObj" is a reference to the parent (calling) object (the tslib_Xmenu class instantiated)
Returns:
array The processed $I array returned (and stored in $this->I of the parent object again)
See also:
tslib_menu::userProcess(), tslib_tmenu::writeMenu(), tslib_gmenu::writeMenu()

Definition at line 105 of file example_itemArrayProcFunc.php.

References debug().

00105                                        {
00106    $itemRow = $conf['parentObj']->menuArr[$I['key']];
00107 
00108       // Setting the document status content to the value of the page title on mouse over
00109    $I['linkHREF']['onMouseover'].='extraRollover(\''.rawurlencode($itemRow['title']).'\');';
00110    $conf['parentObj']->I = $I;
00111    $conf['parentObj']->setATagParts();
00112    $I = $conf['parentObj']->I;
00113    if ($I['parts']['ATag_begin'])   $I['parts']['ATag_begin']=$I['A1'];
00114 
00115    if ($conf['debug'])  {
00116          // Outputting for debug example:
00117       echo 'ITEM: <h2>'.htmlspecialchars($itemRow['uid'].': '.$itemRow['title']).'</h2>';
00118       t3lib_div::debug($itemRow);
00119       t3lib_div::debug($I);
00120       echo '<hr />';
00121    }
00122       // Returns:
00123    return $I;
00124 }

user_itemArrayProcFuncTest menuArr,
conf
 

This function basically adds the parent page to the sublevel but only if the sublevel is empty! It is also used to demonstrate the menu state items.

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/" This TypoScript configuration will also demonstrate it ("fake menu items"):

includeLibs.fakemenuitems = media/scripts/example_itemArrayProcFunc.php page = PAGE page.typeNum = 0 page.10 = HMENU page.10.1 = TMENU page.10.1.expAll = 1 page.10.1.NO { allWrap = | <br /> linkWrap = | } page.10.2 = TMENU page.10.2.itemArrayProcFunc = user_itemArrayProcFuncTest page.10.2.NO { allWrap = | <br /> linkWrap = - | }

Parameters:
array The $menuArr array which simply is a num-array of page records which goes into the menu.
array TypoScript configuration for the function. Notice that the property "parentObj" is a reference to the parent (calling) object (the tslib_Xmenu class instantiated)
Returns:
array The modified $menuArr array

Definition at line 75 of file example_itemArrayProcFunc.php.

00075                                                       {
00076    if ($conf['demoItemStates'])  {     // Used in the example of item states
00077       reset($menuArr);
00078       $c=0;
00079       $teststates=explode(',','NO,ACT,IFSUB,CUR,USR,SPC,USERDEF1,USERDEF2');
00080       while(list($k,$v)=each($menuArr))   {
00081          $menuArr[$k]['ITEM_STATE']=$teststates[$c];
00082          $menuArr[$k]['title'].= ($teststates[$c] ? ' ['.$teststates[$c].']' : '');
00083          $c++;
00084       }
00085    } else { // used in the fake menu item example!
00086       if (!count($menuArr))   {     // There must be no menu items if we add the parent page to the submenu:
00087          $parentPageId = $conf['parentObj']->id;   // id of the parent page
00088          $parentPageRow = $GLOBALS['TSFE']->sys_page->getPage($parentPageId); // ... and get the record...
00089          if (is_array($parentPageRow)) {  // ... and if that page existed (a row was returned) then add it!
00090             $menuArr[]=$parentPageRow;
00091          }
00092       }
00093    }
00094    return $menuArr;
00095 }


Generated on Sun Oct 3 01:06:17 2004 for TYPO3core 3.7.0 dev by  doxygen 1.3.8-20040913