[TYPO3-dev] meta data from plugin

Jacob Rasmussen jacob at lightbulb.dk
Wed Feb 2 10:24:57 CET 2011


Den 01/02/11 17.35, Bart van den Burg skrev:
> I wish to set meta description and meta keywords from within my plugin,
> but I don't quite understand how...
>
> In my main template setup i have the following two lines:
>
> page.meta.keywords.field = keywords
> page.meta.description.field = description
>
> These work fine, they fetch the values from whatever is configured for
> the page. Now I have a plugin from which i want to dynamically set these
> values. How do I do this?
>
> I tried $GLOBALS['TSFE']->page['meta.']['keywords.']['overwrite'], but
> it doesn't work...
>

Hi Bart,

I had to do it through Typoscript instead of coding it directly in my 
plugin.

The plugin has a list and single view mode on different pages - and on 
the single view page I added this to Typoscript setup:

page.meta.description.cObject = RECORDS
page.meta.description.cObject {
   source = {GPvar:tx_blnews_pi1|n}
   source.insertData = 1
   tables = tx_blnews_items
   conf.tx_blnews_items >
   conf.tx_blnews_items = TEXT
   conf.tx_blnews_items {
     field = teaser
   }
}
​
Where tx_blnews_pi1|n is the identifier variable from the plugin.
It is a bit annoying that I have to do more than one database lookup, 
but it's working at least :)

-- 
Regards

Jacob Rasmussen
Certified TYPO3 Integrator




More information about the TYPO3-dev mailing list