[TYPO3-english] 2 variants of extension on the same page with different configurations

JoH asenau info at cybercraft.de
Mon May 17 23:51:58 CEST 2010


> Another solution is to put the plugins on your page with TypoScript.
>
> 10 < plugin.tx_someplugin_pi1
> # the pervious line makes a copy of the plugin
> # allowing configuration per copy
> 10 {
> templateFile = whatever.tmpl
> singlePid = 12
> }


You can have a plugin setup depend on the UID of an element like that:

temp.tx_someplugin_pi1 < plugin.tx_someplugin_pi1

plugin.tx_someplugin_pi1 >
plugin.tx_someplugin_pi1 = CASE
plugin.tx_someplugin_pi1 {
    key.field = uid
    default < temp.tx_someplugin_pi1
    123 < temp.tx_someplugin_pi1
    123 {
        templateFile = whatever.tmpl
        singlePid = 12
    }
}

Simply create sections like 123 for any UID you want to behave differently.

You can even make it independent from the UID but based on the position on
the page, so the first instance will be rendered differently than the
following instances:

plugin.tx_someplugin_pi1 {
    key.data = register:tx_someplugin_pi1_first
    default = COA
    default {
        10 = LOAD_REGISTER
        10.tx_someplugin_pi1_first = 1
        20 < temp.tx_someplugin_pi1
    }
    1 < temp.tx_someplugin_pi1
    1 {
        templateFile = whatever.tmpl
        singlePid = 12
    }
}

And you could make it behave like an even/odd switch so every second
instance will be rendered differently:

plugin.tx_someplugin_pi1 {
    key.data = register:tx_someplugin_pi1_first
    default = COA
    default {
        10 = LOAD_REGISTER
        10.tx_someplugin_pi1_first = 1
        20 < temp.tx_someplugin_pi1
    }
    1 = COA
    1 {
        10 = RESTORE_REGISTER
        20 < temp.tx_someplugin_pi1
        20 {
            templateFile = whatever.tmpl
            singlePid = 12
        }
    }
}

HTH

Joey

-- 
Wenn man keine Ahnung hat: Einfach mal Fresse halten!
(If you have no clues: simply shut your gob sometimes!)
Dieter Nuhr, German comedian
Xing: http://contact.cybercraft.de
Twitter: http://twitter.com/bunnyfield
TYPO3 cookbook (2nd edition): http://www.typo3experts.com




More information about the TYPO3-english mailing list