Question

I have written a Typo3 extension that I want to put 2 times on the same Typo3 page (actually in two parts defined through a templavoila template), but the two instances need different setups!
When I add content to the page through the "Page" module, I can add as many instances of my extension as I want. But in the "Template" module, there is only 1 configuration per page.

So my question is: what is the best way to have different typoscript setups for different instances of a single plugin on the same page?

Thanks for any hints!

Was it helpful?

Solution

Why using template configuration? You could define some configurations for the frontend plugin itself (with flexforms), so every instance could be customized.

OTHER TIPS

If a configuration option is not available as flexform, or there are other reasons why to change the options via TypoScript, you may do it like this:

temp.tx_yourextension < plugin.tx_yourextension
plugin.tx_yourextension >
plugin.tx_yourextension = CASE
plugin.tx_yourextension {

  # check for the uid of the content element (the plugin)
  key.field = uid

  # if nothing special is defined
  default < temp.tx_yourextension

  # the plugin with the uid 1234 needs different configuration
  1234 < temp.tx_yourextension
  1234 {
    property = whatever
  }
}

Instead of requesting the uid, you could check for section_frame or any other field.

But keep in mind, some extensions accessing directly the TypoScript via $GLOBALS['TSFE']->tmpl->setup['plugin.']['tx_yourextension.']['property'] which will prevent this option.

You could do the same on tt_content.list.*

# without tx_ prefix
temp.yourextension < tt_content.list.20.yourextension
tt_content.list.20.yourextension >
tt_content.list.20.yourextension = CASE
...

You can use the flexform to have different setups. Each flexform is stored in a separate database field.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top