Last active
December 15, 2015 02:19
-
-
Save andypa/5186246 to your computer and use it in GitHub Desktop.
Create eID script for TYPO3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. in ext_localconf.php: | |
$TYPO3_CONF_VARS['FE']['eID_include']['bar'] = 'EXT:foo/lib/class.tx_foo.php'; | |
2. in lib/class.foobar.php | |
<?php | |
require_once(PATH_tslib.'class.tslib_pibase.php'); | |
$GLOBALS['TYPO3_DB']->store_lastBuiltQuery = 1; | |
class tx_foobar extends tslib_pibase { | |
var $exclude = array('tt_news' => array(0)); | |
var $cObj, $local_cObj; | |
function __construct() { | |
//Connect to database | |
tslib_eidtools::connectDB(); | |
// only necessary if you want to create links | |
$this->createTSFE(); | |
$this->cObj = t3lib_div::makeInstance("tslib_cObj"); | |
$this->local_cObj = t3lib_div::makeInstance('tslib_cObj'); | |
} | |
function main() { | |
echo "Hello world"; | |
} | |
protected function createTSFE() { | |
require_once(PATH_tslib . 'class.tslib_fe.php'); | |
require_once(PATH_t3lib . 'class.t3lib_page.php'); | |
require_once(PATH_tslib . 'class.tslib_content.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'); | |
if (version_compare(TYPO3_version, '4.3', '<')) { | |
$tsfeClassName = t3lib_div::makeInstanceClassName('tslib_fe'); | |
$GLOBALS['TSFE'] = new $tsfeClassName($GLOBALS['TYPO3_CONF_VARS'], $this->pageId, ''); | |
} | |
else { | |
$GLOBALS['TSFE'] = t3lib_div::makeInstance('tslib_fe', $GLOBALS['TYPO3_CONF_VARS'], $this->pageId, ''); | |
} | |
$GLOBALS['TSFE']->connectToDB(); | |
$GLOBALS['TSFE']->initFEuser(); | |
$GLOBALS['TSFE']->determineId(); | |
$GLOBALS['TSFE']->getCompressedTCarray(); | |
$GLOBALS['TSFE']->initTemplate(); | |
$GLOBALS['TSFE']->getConfigArray(); | |
// Set linkVars, absRefPrefix, etc | |
require_once(PATH_tslib . 'class.tslib_pagegen.php'); | |
TSpagegen::pagegenInit(); | |
} | |
} | |
$foo = t3lib_div::makeInstance('tx_foo'); | |
$foo->main(); | |
?> | |
3. eID script now available at: index.php?eID=bar |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment