[Typo3] Different templates at different levels

Anoop Atre anoop.atre at gmail.com
Tue Aug 9 18:54:04 CEST 2005


I ran into a multi-multi template issue (thanks to our 'designer') some 
months back and I don't know what processing overhead there is, or if 
there was an easier/BETTER way, but I decided to use ONE 'template' 
which then decided what html template to apply on what level and even 
what page. [code below which goes in the SETUP section]

There is always the template page selector extension (which I tried to 
use but decided against for some reason that I don't remember now : )

- - - - - - - - - - - -
# USUAL STUFF FOR TYPO3

page.1 = TEMPLATE
page.1.template = FILE

# ON ROOT LEVEL
[treeLevel = 0]
page.headerData.10 = TEXT
page.headerData.10.value = <script language="JavaScript" 
src="/fileadmin/templates/FOLDER/slideshow.js" 
type="text/javascript"></script>

    config.titleTagFunction = user_pageTitle

# DIFFERENT BODY TAG FOR MAIN PAGE
   page.bodyTag = <body onLoad="runSlideShow()" bgcolor="#CAE4FF">

   page.1.template.file = /fileadmin/templates/FOLDER/TEMPLATE-MAIN.html
[end]

# ON OTHER LEVELS GOING DOWN TO 5 FOR NOW.
# IF THERE ARE MORE YOU NEED TO DECLARE HERE!

[treeLevel = 1,2,3,4,5]
page.bodyTag = <body bgcolor="#ffffff" leftmargin="0" topmargin="0" 
marginwidth="0" marginheight="0">
page.1.template.file = /fileadmin/templates/FOLDER/A-LEVEL.html

# THE FOLLOWING REPEATS WHAT'S IN THE RIGHT COLUMN ON ALL PAGES UNDER 
THAT LEVEL

  [treeLevel = 0,1]

   subparts.REPEAT_RIGHT < # NULL

  [else]

  # Right content from say home(id=11) cObject
   page.1.subparts.REPEAT_RIGHT < styles.content.getRight
   page.1.subparts.REPEAT_RIGHT {
     select {
       pidInList.data = leveluid:1
     }
   }

   [end]

   # BUT ON SOME PAGES YOU NEED DIFFERENT TEMPLATE
   # HERE OVER RIGHT HTML TEMPLATE FOR THOSE PAGES
   [PIDinRootline = 277]
     page.1.template.file = /fileadmin/templates/FOLDER/-LEVEL.html
   [end]

   [PIDinRootline = 2,3,4,5,6,87]
     page.1.template.file = /fileadmin/templates/FOLDER/-LEVEL.html
   [end]

   [PIDinRootline = 7,21,20,79,526]
     page.1.template.file = /fileadmin/templates/FOLDER/-LEVEL.html
   [end]

[end]
- - - - - - - - - - - -

Cheers

~

reena at srijan.in wrote:
> Hi All,
> 
> I am facing a problem of using three different templates for three
> different levels.
> 
> I am using EXT: Template Selector for selecting the templates at different
> pages by editing the page header.My levels are this way:
> 
> Root
>    Home 1 (Level 1)
>       Home 2 (Level 2)
>          Home 3 (Level 3)
>    About Us 1
>       About Us 2
>          About Us 3
> Now I want template1 at root level, at Home 1 level I want to use
> template2, at Home 3 I want to use template4......
> 
> Currently I have to go to each page to select the main and subtemplate.
> 
> Any idea how to select the template of one level at one go.
> 
> Any help would be highly appreciated.
> 
> Thank You.
> 
> Warm Regards,
> Reena Chandel
> 



More information about the TYPO3-english mailing list