[TYPO3-formidable] Mapping ajax events in xmlbuilder?

Andres Toomsalu andres at active.ee
Thu Sep 23 15:08:31 CEST 2010


Thanks Jerome - Ill try that. For a workaround I used includexml and 
dynamic xml file generation from pi - but xmlbuilder would be certainly 
nicer implementation.

----------------------------------------------
Andres Toomsalu, andres at active.ee




JéŽrô™me Schneider wrote:
> Hi,
>
> You might try:
>
> # CODE BEGIN --------------
>
> $sPhp = <<<MYPHP
>   return array(
>     \$this->aORenderlets["sports_modalbox"]->majixCloseBox(),
>     \$this->majixDebug("Hello world!"),
>   );
> MYPHP;
>
> $aXml["renderlet-testing-".$sName] = array(
>     // ...
>     "onclick" => array(
>         "runat" => "ajax",
>         "userobj" => array(
>             "php" => $sPhp,
>         )
>     )
> )
>
> # CODE END --------------
>
>
> To insert PHP I used the HEREDOC syntax; for more informations about 
> this syntax, see here: http://php.net/heredoc
> * Note the \ in front of every $
> * Note also that the closing MYPHP; has to be at the first position on 
> the line (no whitespace before)
>
> As a tip, for better readability, you might want to externalize your 
> PHP events in codebehinds files. See here if you're interested:
> http://formidable.typo3.ug/features/codebehind-syntax.html
>
> Bye bye,
> Jerome Schneider
>
> Le 14/09/10 00:23, Andres Toomsalu a écrit :
>> I havent found any example describing how to map ajax events userobj 
>> when using xmlbuilder - is it even possible?
>>
>> Can I do something like that:
>>
>> <xmlbuilder>
>>                                  <userobj>
>>                                          <php><![CDATA[
>>
>>                                              $aXml = array();
>>
>>                                              //setup renderlets array
>>                                              $aMenuImages = array(
>>                                                  "icon1" =>  '<img 
>> src="fileadmin/icons/icon1.jpg">',
>>                                                  "icon2" =>  '<img 
>> src="fileadmin/icons/icon2.jpg">',
>>                                                  "icon3" =>  '<img 
>> src="fileadmin/icons/icon3.jpg">',
>>                                              );
>>
>>                                              //renderlet generation loop
>>                                              while (list($sName, 
>> $sLabel) = each($aMenuImages)) {
>>
>>                                                  
>> $aXml["renderlet-testing-".$sName] = array(
>>                                                      "type" =>  "LINK",
>>                                                      "name" =>  $sName,
>>                                                      "label" =>  
>> $sLabel,
>>                                                      "style" =>  
>> "cursor: pointer",
>>                                                      "onclick" =>  
>> 'runat="ajax"', //<- how to map onclick userobj here?
>>                                                   );
>>                                              }
>>                                              return $aXml;
>>
>>                                          ]]></php>
>>                                  </userobj>
>>                              </xmlbuilder>
>>
>> And would like these generated LINK elements have onlick section:
>>
>> <onclick runat="ajax">
>>                                      <userobj>
>>                                          <php><![CDATA[
>>
>>                                          return array(
>>                                              
>> $this->aORenderlets["sports_modalbox"]->majixCloseBox(),
>>                                              $this->majixDebug("Hello 
>> world!"),
>>                                          );
>>
>>                                          ]]></php>
>>                                      </userobj>
>>                                  </onclick>
>>
>> How to map this "onclick" event in xmlbuilder situation?
>>
>> Thanks in advance,
>>
>
> _______________________________________________
> TYPO3-project-formidable mailing list
> TYPO3-project-formidable at lists.typo3.org
> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-project-formidable


More information about the TYPO3-project-formidable mailing list