Template depending on right content

Submitting your vote...
Rating: 4.4 of 5. 5 vote(s).
Click the rating bar to rate this item.

Uses the 1. template if in the right column is some content else the 2. one.

 

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
    }
  }
  20 = COA
  20 {
    if.isFalse.numRows < styles.content.getRight
    10 = TEMPLATE
    10 {
       
      template = FILE
      template.file = fileadmin/templates/template.html
    }
  }
}



Comments


igor, 13-07-07 17:23:
This is exactly what I was looking for. Unfortunately it doesn't work though. It always shows the second template, the one defined in 20=COA ...
Igor, 13-07-07 17:54:
I got it to work. Found this on another site:
styles.content.get = CONTENT
styles.content.get {
table = tt_content
select.orderBy = sorting
select.where = colPos=0
select.languageField = sys_language_uid
}

styles.content.getLeft < styles.content.get
styles.content.getLeft.select.where = colPos=1

styles.content.getRight < styles.content.get
styles.content.getRight.select.where = colPos=2

styles.content.getBorder < styles.content.get
styles.content.getBorder.select.where = colPos=3

I had to add this manually to the Typoscript and then it worked.
Tyler, 06-11-07 19:05:
If you also use css_styled_content (CSC) then you shouldn't need to use the second post by Igor.

Using CSC will have previously defined what each of the styles.content.get are.
sami, 02-09-08 09:39:
If you use automaketemplate:

temp.resource = COA
temp.resource {
10 = COA
10 {
if.isTrue.numRows < styles.content.getRight
10 = TEMPLATE
10 {

template = FILE
template.file = fileadmin/tmpl/tmpl01.html
}
}
20 = COA
20 {
if.isFalse.numRows < styles.content.getRight
10 = TEMPLATE
10 {

template = FILE
template.file = fileadmin/tmpl/tmpl02.html
}
}
}

### Configuration of the auto template parser: ###
plugin.tx_automaketemplate_pi1 {
content < temp.resource
Marijus, 15-10-08 11:58:
Beware of double-using the same if option. E.g. what I had was:

ifTrue.numRows < styles.content.getLeft
ifTrue.numRows < styles.content.getRight

and it ignores the first row. That's probably the expected behaviour but strange for a newbie like me.

The workaround was to use:

value = 0
ifGreaterThan.numRows < styles.content.getLeft
ifTrue.numRows < styles.content.getRight

(or .equals instead of repeated isFalse)
Norbert, 16-11-09 10:13:
Please help me with such a problem

I need to load CSS file according to different conditions

(if left and normal columns are not empty)
(if right and normal columns are not empty)
(if left and right and normal columns are not empty)

is it possible to make such complex conditions using typoscript?

Add comment

* - required field

*



*
*

Top 10 Updates

Nice fonts using Google font API geändert am  20-May-2010 16:36:47
TS-based Searchbox for Indexed Search  geändert am  18-May-2010 18:27:15
TYPO3 SEO geändert am  30-Apr-2010 09:44:22
Search engine friendly graphical headers in TYPO3 geändert am  30-Apr-2010 09:33:44
Creating a simple Infocenter using TYPO3 geändert am  17-Nov-2009 12:12:52
Making the Section Menu work correctly with TemplaVoila geändert am  05-May-2009 12:27:17
Show pages with type "Not in Menu" in a sitemap geändert am  05-May-2009 12:11:17
Implementation of the DHTML menu from brainjar.com  geändert am  01-Feb-2009 14:02:48
Sample DHTML menu geändert am  01-Feb-2009 13:51:25
A introduction to the CONTENT object geändert am  26-Jan-2009 13:20:39

Latest comments

20-Aug-2010 16:31:13
pritam schrieb: Hello, Can any body tell me how to add the realurl in the typo3.
Articles
17-Aug-2010 15:25:30
Graham Solomon schrieb: I have developed a nice extension for using this Google Font API with TYPO3, along with their web...
Nice Fonts using Google font API
12-Aug-2010 17:39:44
Ritesh Jaiswal schrieb: I have added the above code into page template but it is not working. It only index the page into...
Index search
Deutsch
Search: