[TYPO3-dev] parse typoscript setup and constants for eID script

Oliver Klee typo3-german-02 at oliverklee.de
Tue Nov 8 10:56:00 CET 2011


Hi,

Am 08.11.2011 00:23, schrieb Simon Schaufelberger (Schaufi):
> i have an eID script and want to parse typoscript there which works
> perfectly fine so far but the only problem is that my *constants* don't
> get replaced and i am looking for a way how to do that properly.

1. You can use the oelib extension for doing this very easily:

// As TS setup is related to a particular page, we need to set it first.
tx_oelib_PageFinder::getInstance()->setPageUid($pageUid);
$configuration = tx_oelib_ConfigurationRegistry::get('plugin.tx_coffee);

$fooStringConfigurationValue = $configuration->getAsString('foo');
$barIntegerConfigurationValue = $configuration->getAsInteger('bar');
$foobarBooleanConfigurationValue = $configuration->getAsBoolean('foobar');

2. Parsing a TS template is very expensive performance-wise. For an eID
script which needs maximum performance, I'd recommend to move the
settings to the EM (in the particular extension). This is much faster.

There's also a convenient helper class for this in oelib;

// The extension key needs to be without the "tx_" prefix.
$configuration = tx_oelib_configurationProxy::getInstance('coffee');
$fooStringConfigurationValue = $configuration->getAsString('foo');
$barIntegerConfigurationValue = $configuration->getAsInteger('bar');
$foobarBooleanConfigurationValue = $configuration->getAsBoolean('foobar');

Hope this helps,


Oli



More information about the TYPO3-dev mailing list