oli.s.
Threadersteller
Dabei seit: 08.01.2007
Ort: Lehre
Alter: 36
Geschlecht:
|
Verfasst Di 12.08.2008 08:57
Titel Typo3 Extensionprogrammierung mit xajax: registerfunction() |
|
|
Guten Morgen!
ich habe ein Problem mit Typo3 und xajax. Ich möchte einen zweiten Request machen mittels einer zweiten PHP-Funktion.
In meinem Script ist bereits eine funktionierende Funktion die ein Request ausführt und auch fehlerfrei den Response ausgibt.
Nun brauch ich aber eine zweite Funktion für einen zweiten Response. Also habe ich die Funktion (genaugenommen sind es ja alles Methoden in einer Klasse) für den Request genommen, da mit
Code: | $this -> xajax -> registerFunction ( array ( 'times', &$this, 'times' ) ); |
meine zweite Funktion registriert, so wie ich es auch mit der ersten gemacht habe, und dann in der Funktion "times" Testweise einen Alert ausgegeben.
times:
Code: | function times($pro) {
$recordProd = $this->pi_getRecord('tx_xxcommvidgal_products', $pro);
$prodstartshow = $recordProd['showpro_start'];
$prodstopshow = $recordProd['showpro_end'];
//##############################################################################################################
//Timedaten an die Javascriptfunktion, diese reagiert bei übereinstimmung und gibt den namen des Produkts zurück
//##############################################################################################################
// Once having prepared the content we still need to send it to the browser ...
// Instantiate the tx_xajax_response object
$this->js = '<script type="text/javascript">';
$this->js .= 'var protimedata = {};';
$this->js .= 'protimedata.product = '.$pro;
$this->js .= 'protimedata.start = '.$prostartshow;
$this->js .= 'protimedata.stop = '.$prostopshow;
$this->js .= '</script>';
$objResponse = new tx_xajax_response ();
$objResponse -> addScript ( "alert('hallo');");
$objResponse -> addAssign ( 'product', 'innerHTML', 'hallo' );
$objResponse -> addAlert( "text");
//return the XML response
return $objResponse -> getXML ( );
} |
Leider kommt der nicht
Request-Funktion:
Code: | function processAjaxRequest ( )
{
# make extension non-cached
$this -> pi_USER_INT_obj = 1;
require_once ( t3lib_extMgm :: extPath ( 'xajax' ).'class.tx_xajax.php' );
$this -> xajax = t3lib_div :: makeInstance ( 'tx_xajax' );
// Decode form vars from utf8 ???
$this -> xajax -> decodeUTF8InputOn ( );
$this -> xajax -> setCharEncoding ( 'utf-8' );
// To prevent conflicts, prepend the extension prefix
$this -> xajax -> setWrapperPrefix ( $this -> prefixId );
// Turn only on during testing
$this->xajax->debugOn();
// Register the names of the PHP functions you want to be able to call through xajax
$this -> xajax -> registerFunction ( array ( 'times', &$this, 'times' ) ); //WIRD NICHT REGISTRIERT!?
/* $GLOBALS['TSFE'] -> additionalHeaderData["times"] .= '
<script type="text/javascript">
var Times = {};
Times.set = 2;
</script>';
*/
if ( !$this -> conf['shownoplayer'] )
{
$this -> xajax -> registerFunction ( array ( 'xajaxNewVideo', &$this, 'xajaxNewVideo' ) );
}
// If this is an xajax request, call our registered function, send output and exit
$this -> xajax -> processRequests ( );
// Else create javascript and add it to the header output
$GLOBALS['TSFE'] -> additionalHeaderData[$this -> prefixId] = $this -> xajax -> getJavascript ( t3lib_extMgm :: siteRelPath ( 'xajax' ) );
//$this->incJsSnippet($this->xajax->getJavascript(t3lib_extMgm::siteRelPath('xajax')));
} |
Das komische ist auch das die Datei im Quellcode registriert zu sein scheint, aber wenn ich den Debug laufen lasse, sagt er immer nur: Calling xajaxNewVideo.
Im Quellcode:
Code: | /*<![CDATA[*/
var xajaxRequestUri="http://xxxx.xxxxxx.xx:8080/xxxxxxxx/index.php?id=17&tx_xxcommvidgal_pi1[video]=0";
var xajaxDebug=true;
var xajaxStatusMessages=false;
var xajaxWaitCursor=true;
var xajaxDefinedGet=0;
var xajaxDefinedPost=1;
var xajaxLoaded=false;
function tx_xxcommvidgal_pi1times(){return xajax.call("times", arguments, 1);}
function tx_xxcommvidgal_pi1xajaxNewVideo(){return xajax.call("xajaxNewVideo", arguments, 1);}
/*]]>*/
|
Kann mir da jemand helfen?
Gruß Olli
Zuletzt bearbeitet von oli.s. am Di 12.08.2008 09:05, insgesamt 2-mal bearbeitet
|
|