[TYPO3-english] simply question about MTB/1
Jigal van Hemert
jigal.van.hemert at typo3.org
Wed Nov 7 08:27:45 CET 2012
Hi,
On 7-11-2012 5:31, tom wrote:
> <?php
> class user_functions {
> /** * Multiplies the current page ID with $conf["factor"]
> */ function multiplyTest($content,$conf) { $currentPageUid =
> $GLOBALS['TSFE']->id; $factor = intval($conf['factor']); return
> $currentPageUid * $factor; }}?>
>
> ...
>
> My question about this code is :
>
> what is $GLOBALS['TSFE'] and $conf['factor'])? And where can I get
> defination of them? Thanks.
The snippet is probably a user function to demonstrate how you can run
PHP from TypoScript.
$GLOBALS['TSFE'] is the global instance of the class tslib_fe. This
class is responsible for building the frontend of the website based on
the TypoScript configuration.
You can find this class in typo3/sysext/cms/tslib/class.tslib_fe.php
$GLOBALS['TSFE']->id is the uid of the current page. In this example
this is just used for a demonstration, because it's obviously useless to
multiply a pageid with a number :-)
$conf is the TypoScript configuration of the current object. The TS of
this example must have a property "factor" where you can set the number
to multiply the page id with.
--
Jigal van Hemert
TYPO3 Core Team member
TYPO3 .... inspiring people to share!
Get involved: typo3.org
More information about the TYPO3-english
mailing list