[TYPO3] Different HTML templates depending on optional right column

Tyler Kraft headhunterxiii at yahoo.ca
Tue Nov 6 19:07:40 CET 2007


easy or hard answer?

Quick and easy way: use the page layout drop down in the page 
properties. you can remove option and rename options via TS in the page 
TSconfig. then using a condition in the template setup you can select 
which template file to use.



Hard (harder?) way: read TSref and get better at understanding 
conditions, if statements, and template item. ;-)

Afaik all that's missing here is the marks! So I think it would need to 
become something like this.

temp.maintemplate= COA
temp.maintemplate {
   10 = COA
   10 {
     if.isTrue.numRows < styles.content.getRight
     10 = TEMPLATE
     10 {
       template = FILE
       template.file = fileadmin/templates/template-2column.html
	workOnSubpart = document_body
	marks.logo < temp.logo
	marks.topnav < temp.topnav
	marks.lhcol < temp.lhcol
     }
   }
   20 = COA
   20 {
     if.isFalse.numRows < styles.content.getRight
     10 = TEMPLATE
     10 {
       template = FILE
       template.file = fileadmin/templates/template.html
	workOnSubpart = document_body
	marks.logo < temp.logo
	marks.topnav < temp.topnav
	marks.lhcol < temp.lhcol

     }
   }
}



And of course make sure that you've included css_styled_content.

hth

Rickard Andersson wrote:
> Howdy,
> 
> I'm trying to setup my TypoScript to use different HTML templates
> depending on whether the page has any content in the right column or
> not. In essense, what I want is to use 2col.html if the page has
> anything in the right column and 1col.html if it doesn't. I found
> something relating to this at typo3wizard.com, but I can't make any
> sense out of it:
> 
> http://www.typo3wizard.com/en/content-comments.html?no_cache=1&tx_rfcontentcomments_pi1%5Bcontentuid%5D=293
> 
> Here's a shortened version of what I have today:
> 
> temp.mainTemplate = TEMPLATE
> temp.mainTemplate {
>  template = FILE
>  template.file = fileadmin/template/2col.html
> 
>  marks.HEADER_1 = TEXT
>  marks.HEADER_1.field = title
>  marks.MAIN_CONTENTS = TEXT
>  marks.MAIN_CONTENTS < styles.content.get
>  marks.RIGHT_CONTENTS = TEXT
>  marks.RIGHT_CONTENTS < styles.content.getRight
> }
> 
> Can anyone instruct me how to adapt this to load 1col.html in case
> styles.content.getRight is empty?
> 
> Cheers,
> Rickard


More information about the TYPO3-english mailing list