[TYPO3-dev] xajax !! several extension using xajax on the same page of typo3 throwing errors
Nirmalya Mondal
typo3india at gmail.com
Tue May 20 20:29:23 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've tried with your code.
The header part contains..
-------------------------------
<script type="text/javascript">
/*<![CDATA[*/
var
xajaxRequestUri="http://localhost/awilly/index.php?id=10&no_cache=1&no_cache=1";
var xajaxDebug=false;
var xajaxStatusMessages=true;
var xajaxWaitCursor=true;
var xajaxDefinedGet=0;
var xajaxDefinedPost=1;
var xajaxLoaded=false;
function c4baby_processGbookRatingEntry(){return
xajax.call("processGbookRatingEntry", arguments, 1);}
function c4baby_processGbookCommentEntry(){return
xajax.call("processGbookCommentEntry", arguments, 1);}
/*]]>*/
</script>
<script type="text/javascript"
src="typo3conf/ext/xajax/xajax_js/xajax.js"></script>
<script type="text/javascript">
window.setTimeout(function () { if (!xajaxLoaded) { alert('Error: the
xajax Javascript file could not be included. Perhaps the URL is
incorrect?\nURL: typo3conf/ext/xajax/xajax_js/xajax.js'); } }, 6000);
</script>
---------------------------------
when I've called javascript function c4baby_processGbookCommentEntry()
it throws the same error as previous i.e.
Unknown Function processGbookCommentEntry.
Where this function has defined in _p2.php file.
As previous processGbookRatingEntry() php function is working fine ..
this function has defined in _pi1.php file.
Please help me where i am wrong. If you want i cansend you the whole code.
--
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