[Typo3] Acccess typoscript constants (in templates) via PHP

JoH info at cybercraft.de
Thu Jun 16 12:45:06 CEST 2005


> There's a custom typo3 extension and I want to pass constant
> parameters from the template to the extension.
> How can I access a constant which was defined in the Constants field
> of an template via PHP?
>
> I searched now for some time and found only hints as access them by...
>
> - $this->conf
> or
> - $GLOBALS['TSFE']->tmpl->flatSetup
>
> But nothing of it worked...
>
> I also debugged the array above with t3lib_div::debug() but without
> success of finding the defined values
> in the templates' constants field.

One possible solution: Use the constants in your setup field.
AFAIK a constant itself does nothing unless it is put into the setup on a
certain place.

Something like
content {
    defaultHeaderType = 1
}
in the constants has no effect until you do something like this in your
setup
10.key.ifEmpty = {$content.defaultHeaderType}

Have a look at CSS-styled-content with the Template Analyzer.
It's making heavy use of constants.

Joey

-- 
Wenn man keine Ahnung hat: Einfach mal Fresse halten!
(If you have no clues: simply shut your knob sometimes!)
Dieter Nuhr, German comedian
openBC: http://www.openbc.com/go/invuid/Jo_Hasenau






More information about the TYPO3-english mailing list