[TYPO3-english] Using variable in $addWhere select statement

christian oettinger christian.oettinger at gmx.de
Thu Jan 10 17:21:37 CET 2013


Hi Adrian,

We forget about why you are doing it the way you do and assume you have 
good reason. I assume that you are using piBase to develop your 
extension. I'll write detailed, for it may help other people too.

a) Usually you are in one plugin (pi1) in one extension (ext1). You are 
in one function (listView) and create links to call the plugin again 
with a parameter in URL (e.g. tx_ext1_pi1[showUid]=12). TYPO3 detects 
the parameter and because of it redirects to another function (singleView).
TYPO3 also takes the parameter and puts it into $this->piVars (in our 
case you cann access $this->piVars['showUid'] qhile in pi1 of ext1).
To create the links you usually use a funciton like pi_list_linkSingle. 
This function is written to do exactly the above: jumping to singleView 
in the same plugin. The parameters in the URL are created exactly for 
that purpose.

b) You want jump from pi1 of ext1 to pi1 of ext2. So you don't nedd
www.qqq.com/Index.php?id=15&tx_ext1_pi1[showUid]=388
www.qqq.com/Index.php?id=15&tx_ext2_pi1[showUid]=388
To do so, you just have to use another function for generating the links 
in listView, e.g. pi_linkToPage. Here you can define your parameters 
freely. A working example should be:


$urlParameters = array(
   'tx_ext2_pi1[showUid]' => $targetRecordUid
);
$link = $this->pi_linkToPage($linktext, $targetpage, '',$urlParameters);


hope this helps
greetings!
christian (oe)




> I have 2 extensions on different pages.
>
> List view is rendered by extension_1
>
> Single view is rendered by extension_2
>
> I`m transferring a variable from list to single in url:
>
> www.qqq.com/Index.php?tx_ext1_pi1[showUid]=388<http://www.qqq.com/Index.php?tx_ext1_pi1%5bshowUid%5d=388>
>
>
>
> in second extension I need to add this variable to $addWhere in my select
> query. How to add it do $addWhere?
>
>
> Adrian
>



More information about the TYPO3-english mailing list