[TYPO3-UG Italy] PHP_SCRIPT_INT e ajax

Michael Tamburini barcarogf+typo3 at gmail.com
Fri Feb 11 17:30:09 CET 2011


Aggiungo che con questa inizializzazione all'inizio del file ora 
funziona tutto come un orologio (cit. Califano):

if($_GET['ajax'] == 1){

	define ('CRLF', "\r\n");
	define ('DQT', '"');
	define ('QT', "'");
	
	// *********************
	// Libraries included
	// *********************
	$TT->push('Include Frontend libraries','');
		require_once(PATH_tslib.'class.tslib_fe.php');
		require_once(PATH_t3lib.'class.t3lib_page.php');
		require_once(PATH_t3lib.'class.t3lib_userauth.php');
		require_once(PATH_tslib.'class.tslib_feuserauth.php');
		require_once(PATH_t3lib.'class.t3lib_tstemplate.php');
		require_once(PATH_t3lib.'class.t3lib_cs.php');
	$TT->pull();
	
	// ***********************************
	// Create $TSFE object (TSFE = TypoScript Front End)
	// Connecting to database
	// ***********************************
	$temp_TSFEclassName=t3lib_div::makeInstanceClassName('tslib_fe');
	$TSFE = new $temp_TSFEclassName(
			$TYPO3_CONF_VARS,
			t3lib_div::_GP('id'),
			t3lib_div::_GP('type'),
			t3lib_div::_GP('no_cache'),
			t3lib_div::_GP('cHash'),
			t3lib_div::_GP('jumpurl'),
			t3lib_div::_GP('MP'),
			t3lib_div::_GP('RDCT')
		);
	$TSFE->connectToMySQL();
	if ($TSFE->RDCT)	{$TSFE->sendRedirect();}
	
	
	// *******************
	// output compression
	// *******************
	if ($TYPO3_CONF_VARS['FE']['compressionLevel'])	{
		ob_start();
		require_once(PATH_t3lib.'class.gzip_encode.php');
	}
	
	// *********
	// FE_USER
	// *********
	$TT->push('Front End user initialized','');
		$TSFE->initFEuser();
	$TT->pull();
	
	
	
	
	
	
	// *****************************************
	// Proces the ID, type and other parameters
	// After this point we have an array, $page in TSFE, which is the 
page-record of the current page, $id
	// *****************************************
	$TT->push('Process ID','');
		// not needed and doesnot work with realurl //
	$TSFE->checkAlternativeIdMethods();
		$TSFE->clear_preview();
		$TSFE->determineId();
	
			// Now, if there is a backend user logged in and he has NO access to 
this page, then re-evaluate the id shown!
		if ($TSFE->beUserLogin && !$BE_USER->extPageReadAccess($TSFE->page))	{
	
				// Remove user
			unset($BE_USER);
			$TSFE->beUserLogin = 0;
	
				// Re-evaluate the page-id.
			$TSFE->checkAlternativeIdMethods();
			$TSFE->clear_preview();
			$TSFE->determineId();
		}
		$TSFE->makeCacheHash();
	$TT->pull();
	
	
	// *******************************************
	// Get compressed $TCA-Array();
	// After this, we should now have a valid $TCA, though minimized
	// *******************************************
	$TSFE->getCompressedTCarray();
	
	
	// ********************************
	// Starts the template
	// *******************************
	$TT->push('Start Template','');
		$TSFE->initTemplate();
		$TSFE->tmpl->getFileName_backPath = PATH_site;
	$TT->pull();
	
	
	// ******************************************************
	// Get config if not already gotten
	// After this, we should have a valid config-array ready
	// ******************************************************
	$TSFE->getConfigArray();
	
	$conf = $TSFE->tmpl->setup['plugin.']['tx_myplugin.'];

}

(Fonte: 
http://lists.typo3.org/pipermail/typo3-dev/2006-December/021392.html)

Ciao!

Il 11/02/11 15:30, Federico Bernardin ha scritto:
> Ciao,
> il tuo problema è che stai usando la classe cObj, senza averla inizializzata e quindi potrebbe avere oggetti vuoti al suo interno, così su due piedi si dovrebbe vedere il codice sorgente per dirti qualcosa in più.
> Se metti il codice che usa cObj, si può dire qualcosa di più.
>
> Ciao
> Federico
>
>
> Il giorno 11/feb/2011, alle ore 14.51, Michael Tamburini ha scritto:
>
>> Salve a tutti, ho realizzato uno script da includere con PHP_SCRIPT_INT che mi crea un calendarietto per gli eventi basato sul tt_news. L'idea sarebbe quella di renderlo navigabile per mese con aggiornamenti ajax.
>>
>> Ho messo il codice qua per condividerlo: http://www.copypastecode.com/63519/
>>
>> Tutto bene per quanto riguarda l'inclusione via PHP_SCRIPT_INT, il problema sorge quando vado a richiamare via ajax e ho un mese con eventi attivi, quindi il sistema dovrebbe creare il link con $cObj->getTypolink_URL().
>>
>> In questa fase il sistema mi restituisce questo errore:
>>
>> Fatal error:  Call to a member function getPage_noCheck() on a non-object in /home/sites/miosito/typo3/sysext/cms/tslib/class.tslib_content.php on line 5509
>>
>> Ho fatto un po' di ricerche ma senza esito. Immagino che si debba in qualche modo inizializzare TYPO3 senza che "esca la pagina" solo che non sono stato in grado. In passato avevo usato il meccanismo eID però in questo caso non sono riuscito neppure con eID. Come posso fare per "usare" le funzionalità di TYPO3 in uno script "esterno" (userei anche le funzionalità per fare la query sul db anziché connettermi "in linea")?
>>
>> Ciao,
>> Michael.
>> _______________________________________________
>> TYPO3-UG-Italy mailing list
>> TYPO3-UG-Italy at lists.typo3.org
>> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-ug-italy
>



More information about the TYPO3-UG-Italy mailing list