[TYPO3] dynamically change header layout from extension

Patrick Rodacker patrick.rodacker at the-reflection.de
Tue Sep 5 20:51:09 CEST 2006


Hi Krystian,

Krystian Szymukowicz wrote on 05.09.2006 12:16:

> I'd like to change header layout depending on some values in extension.
> 
> This line in Template Setup works as expected:
> 
> lib.stdheader.10.1.fontTag=
> <h3{register:headerStyle}{register:headerClass}>|</h3>
> 
> 
> but as I said I am trying to make it dynamically from extension if
> certain condition is met. I do something like this:
> 
> 
> $GLOBALS['TSFE']->tmpl->setup['lib.']['stdheader.']['10.']['1.']['fontTag']
> = '<h3{register:headerStyle}{register:headerClass}>|</h3>';
> 
> or
> 
> $GLOBALS['TSFE']->tmpl->setup['tt_content.']['header.']['10.']['1.']['fontTag']
> = '<h3{register:headerStyle}{register:headerClass}>|</h3>';
> 
> 
> but it has no effect :(
> 
> 
> Any hint where can be the problem?

normally you could set the register from within an extension using:

$GLOBALS['TSFE']->register['key'] = $value;

but in your case I guess setting the register key for the header from an
extension will be too late in the rendering process. I don't know where
exactly and when the register is accessed for the rendering of the
header, so maybe someone could clarify this.

Why not use ts conditions - as you wrote yourself - and then set the
header wraps when these conditions are met? Something like:

[your condition is met]
<h3 class="myclass">|</h3>
[global]

Have a look at the conditions section of TSRef [1] and search for
userFunc to see how to set up your own conditions.

HTH
Patrick

[1]
http://typo3.org/documentation/document-library/references/doc_core_tsref/current/view/4/1/



More information about the TYPO3-english mailing list