Am 28.01.2013 18:34, schrieb Christian Platt:
Hallo Liste,


ich möchte aus einer Extension per EID auf Contentobjekte zugreifen. (4.5. LTS)

Dazu habe ich das eID wie folgt aufgebaut:
Quelle: 
http://www.typo3-tutorials.org/tutorials/entwicklung/typo3-und-ajax-wie-geht-das.html


class unsereKlasse {

     public function main() {
         $feUserObject = tslib_eidtools::initFeUser();
         $TSFEObject = tslib_eidtools::getTSFE();
         return json_encode(array('myResult' => 'World'));
     }

}

$output = t3lib_div::makeInstance('unsereKlasse');
echo $output->main();


Allerdings bekomme ich bei dem Aufruf einen

"Fatal error: Call to private method tslib_eidtools::getTSFE() from context '"


Eigentlich sollten die doch public sein, oder?
http://doc-typo3.ameos.com/4.1.0/classtslib__eidtools.html


Liebe Grüße
Christian

Hmm..
ich habe mich das auch mal gefragt und dann einfach ein Workaraound mir geschaffen.
Hier mal mein Code
include_once('./typo3/sysext/cms/tslib/class.tslib_fe.php');
include_once('./typo3/sysext/cms/tslib/class.tslib_content.php');
include_once('./t3lib/class.t3lib_tstemplate.php');
include_once('./t3lib/class.t3lib_page.php');
include_once('./typo3conf/localconf.php');


if (!defined ('PATH_typo3conf')) die ('Could not access this script directly!');

//Ich übergebe eben bei dem eID aufruf die page Id
$pid = intval(t3lib_div::_GP('pid'));
$feUserObj = tslib_eidtools::initFeUser();
tslib_eidtools::connectDB();

$TSFE = t3lib_div::makeInstance('tslib_fe',$TYPO3_CONF_VARS, intval($pid), 0, true);
$TSFE->fe_user = $feUserObj;
$TSFE->sys_page = t3lib_div::makeInstance('t3lib_pageSelect');
$TSFE->tmpl = t3lib_div::makeInstance('t3lib_tstemplate');
$TSFE->tmpl->init();
$TSFE->rootLine = $TSFE->sys_page->getRootLine(intval($pid));
$TSFE->getConfigArray();
$GLOBALS['TSFE'] = $TSFE;

Bis dann
FIorian
_______________________________________________
TYPO3-german mailing list
TYPO3-german@lists.typo3.org
http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-german

Antwort per Email an