user2507818
user2507818

Reputation: 3037

typo3: how does this work: $GLOBALS['TSFE']->tmpl?

in one extension file: I run below code:

var_dump($GLOBALS['TSFE']->tmpl->setup['plugin.']['tx_watermark_pi1.']);

the result is :

["hooks."]=> array(4) { ["dagou_post."]=> array(1) { ["view."]=> array(2) { ["state."]=> array(1) { ["template"]=> string(11) "###INPUT###" }...

and I can tell it outputs this file: ext_typoscript_setup.txt inside extension:watermark and also the ts settings from global and local pages.

Question:

I checked file: typo3\sysext\cms\tslib\class.tslib_fe.php, and trying to figure out how does this work: $GLOBALS['TSFE']->tmpl->setup['plugin.']['tx_watermark_pi1.'], but only saw var $tmpl=''; from this code: $GLOBALS['TSFE']->tmpl->setup['plugin.']['tx_watermark_pi1.'], tmpl should be an object, and setup['plugin.']['tx_watermark_pi1.'] should be the property. So anyone can give me some explanation on how does $GLOBALS['TSFE']->tmpl->setup['plugin.']['tx_watermark_pi1.'] work? thanks.

Upvotes: 0

Views: 2783

Answers (2)

Viktor Livakivskyi
Viktor Livakivskyi

Reputation: 3228

$GLOBALS['TSFE']->tmpl->setup is the cumulative recursive TS setup of your compete website. It gathers all TS templates, found in rootline from your current selected page, parses it and compiles into array.

Obviously, you will find nothing about tx_watermark_pi1 in class.tslib_fe.php, because tslib_fe knows nothing about it - it just creates FE, and one of the tasks is to create tmpl object, that contains complete setup of all TS, found in rootline.

You can find more info on TS parsing here

Upvotes: 1

Michael
Michael

Reputation: 2331

The typoscript code you write and also the ts-files delivered with the extensions you have installed are parsed to php and then cached. When the frontend is built up, this very big php array is written to this global object and then read from there by several other classes like extension plugins and so on.

You can find that code in the t3lib/class.t3lib_tsparser*.php classes if you want to take a look (although I don't think that will help you).

Upvotes: 0

Related Questions