[TYPO3-dev] Adding meta tags in Extension?

Elmar Hinz elmar.DOT.hinz at team.MINUS.red.DOT.net
Fri Sep 1 00:29:03 CEST 2006


Martin Kutschker wrote:
> Heiner Lamprecht schrieb:
>> On Thursday 31 August 2006 13:55, Dmitry Dulepov wrote:
>>> Hi!
>>>
>>> Heiner Lamprecht wrote:
>>>> I'm looking for a possibility to add meta tags to a page from
>>>> within my extension.  I'm writing an extension that displays
>>>> images on a page and would like to add the keywords from the
>>>> DAM backend to the meta tags of that page.
>>> $GLOBALS['TSFE']->config['config']['additionalHeaders']
>>>
>>> Read about config.additionalHeaders format in TSRef.
>>
>> The documentation talks about HTTP-headers, like redirection, not
>> about meta tags in the HTML head.
>>
>> I tried to write the keywords in $GLOBALS['TSFE']->page['keywords']. 
>> But it seems, that the output is already created, before my extension
>> adds the new keywords. ;-(
> 
> Beware that you cannot change the HTML header from a USER_INT object.
> THe reason is that during the time the USER_INT code is executed the
> HTML header is already generated and cached.
> 
> Masi

Hi Masi,

this technic you find in xajax_tutor. Although your theory is fine it
seems to work within USER_INT. Maybe the head is not cached. Just a
guess. :-)

$cssFile = $configuration['cssFile'];
$absPath = t3lib_div::getFileAbsFileName($cssFile);
$relPath = substr($absPath, strlen(PATH_site));	
		$GLOBALS['TSFE']->additionalHeaderData['tx_resultbrowser']
  = '<link rel="stylesheet" type="text/css" href="'. $relPath . '" />';

Regards

Elmar








	




$cssFile = $configuration['cssFile'];
$absPath = t3lib_div::getFileAbsFileName($cssFile);
$relPath = substr($absPath, strlen(PATH_site));	
		$GLOBALS['TSFE']->additionalHeaderData['tx_sbresultbrowser'] = '<link
rel="stylesheet" type="text/css" href="'. $relPath . '" />';
	




More information about the TYPO3-dev mailing list