[TYPO3] typolink with cli / backend plugin

Klaus Hinum k_hinum at hotmail.com
Mon Feb 19 12:38:58 CET 2007


Peter Klein schrieb:
> Hi Klaus.
> 
> All the "tslib" classes are for use in Frontend plugins. And what you are 
> trying to make (cli script) is a Backend feature.
> As you cli script has no connection to the pages or content.
> 
> But if you REALLY need it, you'll have to include 7 classes (maybe more), 
> create a fake TSFE array, and initialize your cObj.
> 
> Something like this:
> 
> require_once(PATH_tslib.'class.tslib_fe.php');
> require_once(PATH_t3lib.'class.t3lib_userauth.php');
> require_once(PATH_tslib.'class.tslib_feuserauth.php');
> require_once(PATH_t3lib.'class.t3lib_cs.php');
> require_once(PATH_tslib.'class.tslib_content.php');
> require_once(PATH_t3lib.'class.t3lib_tstemplate.php');
> require_once(PATH_t3lib.'class.t3lib_page.php');
> 
> $TSFEclassName = t3lib_div::makeInstanceClassName('tslib_fe');
> $id = isset($HTTP_GET_VARS['id'])?$HTTP_GET_VARS['id']:0;
> 
> $GLOBALS['TSFE'] = new $TSFEclassName($TYPO3_CONF_VARS, $id, '0', 1, '', 
> '','','');
> $GLOBALS['TSFE']->connectToMySQL();
> $GLOBALS['TSFE']->initFEuser();
> $GLOBALS['TSFE']->fetch_the_id();
> $GLOBALS['TSFE']->getPageAndRootline();
> $GLOBALS['TSFE']->initTemplate();
> $GLOBALS['TSFE']->tmpl->getFileName_backPath = PATH_site;
> $GLOBALS['TSFE']->forceTemplateParsing = 1;
> $GLOBALS['TSFE']->getConfigArray();
> 
> $cObj = t3lib_div::makeInstance('tslib_cObj');
> $cObj->start(array(),'');
> echo $cObj->getTypoLink('Visit TYPO3.ORG','www.typo3.org');
> 
> 

HiPeter,

some class or value is still missing:

Fatal error: Call to a member function on a non-object in 
/srv/www/typo3_src/typo3_src-4.0.1/typo3/sysext/cms/tslib/class.tslib_fe.php 
on line 818

any idea?

regards
Klaus


More information about the TYPO3-english mailing list