[TYPO3-dev] xajax !! several extension using xajax on the same page of typo3 throwing errors
Nirmalya Mondal
typo3india at gmail.com
Tue May 20 17:31:14 CEST 2008
Mauro Lorenzutti wrote:
>
> I solved in this way (not the best one but the only one I found...):
>
> I created a global var with the xajax object:
>
> global $lm_xajax;
>
> then I initialize the object if it has not been initialized yet:
>
> if (!is_object($lm_xajax)) {
> require_once (t3lib_extMgm::extPath('xajax') .
> 'class.tx_xajax.php');
> // Make the instance
> $lm_xajax = t3lib_div::makeInstance('tx_xajax');
> // Decode form vars from utf8 ???
> $lm_xajax->decodeUTF8InputOn();
> // Encode of the response to utf-8 ???
> $lm_xajax->setCharEncoding('utf-8');
> // To prevent conflicts, prepend the extension prefix
> $lm_xajax->setWrapperPrefix('c4baby_');
> // Do you wnat messages in the status bar?
> $lm_xajax->statusMessagesOn();
> $reqURI =
> t3lib_div::getIndpEnv('TYPO3_REQUEST_URL');
> if (strpos($reqURI, '?')>0)
> $reqURI .= '&no_cache=1';
> else
> $reqURI .= '?no_cache=1';
> $lm_xajax->setRequestURI($reqURI);
> }
>
> Then I register my functions as usual:
>
> $lm_xajax->registerFunction(array('searchRecipe', &$this, 'searchRecipe'));
>
> // If this is an xajax request, call our registered function, send
> output and exit
> $lm_xajax->processRequests();
> // Else create javascript and add it to the header output
> $GLOBALS['TSFE']->additionalHeaderData['c4baby_'] =
> $lm_xajax->getJavascript(t3lib_extMgm::siteRelPath('xajax'));
>
>
> I hope this can help you.
>
> The problem is that only one xajax object is allowed for page. In this
> way, you can register only one object in a lot of extensions.
>
> Regards,
>
Ok Mauro,
I'll try to implement this in your way..
thanks a lot for helping me with code..
I'll contact you if i am in need help of yours.. please
--
Thank You.
Kind Regards,
Nirmalya Mondal
http://www.edimensions.in
--------------------------------
Phone: +91-990-3743-222
Skype: typo3developer
Yahoo: enirmalya at yahoo.com
Web: http://www.nirmalya.info
More information about the TYPO3-dev
mailing list