[TYPO3] Is template switching on the fly possible?

Pascal Cramer pascal at NOSPAMroguesheep.nl
Tue Aug 26 12:05:50 CEST 2008


Hi Ronald,

I you need FE template switching and use automaketemplate (not TV) perhaps you 
can use someting I used a while ago to demonstrate different layouts:

I used external files for some TS which I placed in different directories and 
include based on the QS parameter D:

Constants:
----
<INCLUDE_TYPOSCRIPT: source="FILE: fileadmin/templates/a/constants.ts">
[globalVar=GP:D=1]
plugin.tx_automaketemplate_pi1 <
<INCLUDE_TYPOSCRIPT: source="FILE: fileadmin/templates/b/constants.ts">
[end]
[globalVar=GP:D=2]
plugin.tx_automaketemplate_pi1 <
<INCLUDE_TYPOSCRIPT: source="FILE: fileadmin/templates/c/constants.ts">
[end]
----

Setup
----
<INCLUDE_TYPOSCRIPT: source="FILE: fileadmin/templates/a/setup.ts">
[globalVar=GP:D=1]
tiny_lib <
plugin.tx_automaketemplate_pi1.elements <
page.10.subparts <
<INCLUDE_TYPOSCRIPT: source="FILE: fileadmin/templates/b/setup.ts">
[end]
[globalVar=GP:D=2]
tiny_lib <
plugin.tx_automaketemplate_pi1.elements <
page.10.subparts <
<INCLUDE_TYPOSCRIPT: source="FILE: fileadmin/templates/c/setup.ts">
[end]
----

For the switcher in your FE:
----
lib.switcher = COA
lib.switcher {
  1 = TEXT
  1 {
   value = Coffeecup
   stdWrap.typolink.parameter.data = TSFE:id
  }
  2 = TEXT
  2 {
   value = Purple
   stdWrap.typolink {
     parameter.data = TSFE:id
     additionalParams = &D=1
   }
  }
  3 = TEXT
  3 {
   value = Business
   stdWrap.typolink {
     parameter.data = TSFE:id
     additionalParams = &D=2
   }
  }
  wrap = <div id="design_switch">|</div>
}
----

Hope this helps.

Pascal

ronald_lists at elmit.com wrote:
> I wonder, if and how it is possible to show one and the same site with
> different templates, so that we can easy compare them.
> 
> My first idea was just to install 15 times typo3, but when I think that
> this could lead at the end to 100, I am not so excited anymore.
> 
> Any ideas, pointers or suggestions?
> 
> bye
> 
> Ronald


More information about the TYPO3-english mailing list