[TYPO3] Different HTML templates depending on optional right column
Rickard Andersson
rickard.andersson+typo3 at gmail.com
Wed Nov 7 10:32:51 CET 2007
I'm afraid I don't exactly understand what you mean. I tried this:
temp.maintemplate = COA
temp.maintemplate {
10 = COA
10 {
if.isTrue.numRows < styles.content.getRight
10 = TEMPLATE
10 {
template = FILE
template.file = fileadmin/template/2col.html
}
}
20 = COA
20 {
if.isFalse.numRows < styles.content.getRight
10 = TEMPLATE
10 {
template = FILE
template.file = fileadmin/template/1col.html
}
}
}
temp.mainContent = TEMPLATE
temp.mainContent {
template.file < temp.mainTemplate
marks.HEADER_1 = TEXT
marks.HEADER_1.field = title
marks.MAIN_CONTENTS < styles.content.get
marks.RIGHT_CONTENTS < styles.content.getRight
}
And then at the end of the template:
page = PAGE
page.10 < temp.mainContent
But all I get is a blank page.
Cheers,
Rickard
On Nov 7, 2007 9:58 AM, Bernd Wilke <xoonsji02 at sneakemail.com> wrote:
> Tyler Kraft schrieb:
> > 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
> marks.MAIN_CONTENTS < styles.content.get
> marks.RIGHT_CONTENTS < styles.content.getRight
>
> > }
> > }
> > 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
> marks.MAIN_CONTENTS < styles.content.get
> >
> > }
> > }
> > }
> >
> As you have the markers twice this wouldn't be my preferred solution.
> (you also missed the two main contents ;-) )
>
> > 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
>
> this example just decides the name of the template and so i will use it:
>
> >>
> >>
> >> Here's a shortened version of what I have today:
> >>
> >> temp.mainTemplate = TEMPLATE
> >> temp.mainTemplate {
>
> this might be confusing as you are doing something different as in the
> example of your url.
>
> just a rename to use the original contruction with the origianl name:
>
> temp.mainContent = TEMPLATE
> temp.mainContent {
> >> template = FILE
> // template.file = fileadmin/template/2col.html // overwritten by:
> // here is the info from the external part:
> template.file < temp.mainTemplate
> >>
> >> marks.HEADER_1 = TEXT
> >> marks.HEADER_1.field = title
> //marks.MAIN_CONTENTS = TEXT // is overwritten by:
> >> marks.MAIN_CONTENTS < styles.content.get
> //marks.RIGHT_CONTENTS = TEXT // is overwritten by:
> >> marks.RIGHT_CONTENTS < styles.content.getRight
> >> }
>
> and dont copy the leading '>>' which show your original lines
>
> >> Can anyone instruct me how to adapt this to load 1col.html in case
> >> styles.content.getRight is empty?
> >>
> >> Cheers,
> >> Rickard
>
> Bernd
> --
> http://www.pi-phi.de/t3v4/cheatsheet.html
>
> _______________________________________________
> TYPO3-english mailing list
> TYPO3-english at lists.netfielders.de
> http://lists.netfielders.de/cgi-bin/mailman/listinfo/typo3-english
>
More information about the TYPO3-english
mailing list