[TYPO3] Pass GET values in Menu Link using TS

FEZ (Felix Kratzer) fez at stoccer.de
Thu Feb 2 19:37:55 CET 2006


OK! here you Go:
TS-Setup:
includeLibs.logoutEnhancer = fileadmin/path/to/yours/forum_iprocfunc.php
menu2 = HMENU
menu2.entryLevel = 1
menu2.1 = GMENU
menu2.1.IProcFunc = user_itemArrayProcFunc
#replace menu2(.1) by whatever you use!!

The php-File (forum_iprocfunc.php)
<?php

/**
* @param	array	The $menuArr array which simply is a num-array of page 
records which goes into the menu.
* @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)
* @return       array   The modified $menuArr array
**/
function user_itemArrayProcFunc($menuArr,$conf){
   $idToGoFor = "127";
   $newStuff = "&logintype=logout";
   if($menuArr["uid"]==$idToGoFor){
     // D1
     $menuArr["linkHREF"]["HREF"] .= $newStuff;
     $menuArr["A1"] = 
str_replace("id=".$idToGoFor,"id=".$idToGoFor.$newStuff,$menuArr["A1"]);
     $menuArr["parts"]["ATag_begin"] = 
str_replace("id=".$idToGoFor,"id=".$idToGoFor.$newStuff,$menuArr["parts"]["ATag_begin"]);
     //D2
   }
   return $menuArr;
}

This simply changes ALL the link stuff for the menuitem of page id=127!

What you have to do to make it work is simple:
1. in the line $idToGoFor = "127"; replace "127" with the ID of you page
2. set $newStuff to whatever you want to ADD to the links.

Everything else should work (I think). If not add the following line to 
the code marked with //D1 or //D2:
t3lib_div::debug($menuArr);

This will show you the MenuItem infos befor (D1) or after(D2) the change!

ENJOY


Surajit wrote:
> Hi FEZ,
> 
> We want to add the params to ONE special item of the menu.
> Please post an example of your "IProcFunc".
> 
> Thanks for your reply.
> 
> Thanks,
> Surajit
> 
> FEZ (Felix Kratzer) wrote:
> 
>> Surajit wrote:
>>  
>>
>>> Hi All,
>>>
>>> An overview of what we want to acheive:
>>> 1. We have 2 pages [with our custom plugin installed]
>>> 2. One shows "List View" and another shows "Detailed View"
>>> 3. Once we are in "Detailed View" a Menu Link will be visible as main
>>> menu item.
>>> 4. The "Detailed View" page displays url with params (like for eg.
>>> /index.php?id=X&a=1&b=2...)
>>> 5. Now we want the same url of "Detailed View" to appear in the new menu
>>> link
>>>
>>> [All the GET values has to be passed to this menu link]
>>>
>>> Please tell whether we can solve it using typoscript.
>>>
>>>
>>> Thanks and regards,
>>> Surajit
>>> Srijan Technologies, India
>>>   
>>
>>
>> If you want to add those params to ALL items in the menu check the 
>> .addParam of a menu!
>>
>> If you want only to add the params to ONE spcial item of the menu you 
>> need the .IProcFunc!
>>
>> If the latter is the case I can post you an example I did with an 
>> IProcFunc
>>
>> FEZ
>> _______________________________________________
>> TYPO3-english mailing list
>> TYPO3-english at lists.netfielders.de
>> http://lists.netfielders.de/cgi-bin/mailman/listinfo/typo3-english
>>
>>  
>>
> 



More information about the TYPO3-english mailing list