[TYPO3-english] Load Different Template Based on Page's Content

Scotty C superscotty19 at yahoo.com
Wed Sep 17 08:54:56 CEST 2014


Hi everyone,

I'm sure this one isn't too tricky but I've been staring at code far too long that it's all just a blur.

I've got a page tree like this:

- Root_Page (id=1)
--- Page_1 (id=55)
--- Page_2 (id=3)
------ Page_3 (id=4)
------ Page_4 (id=5)

I also have 2 HTML templates.

Now, this is going to sound weird but, I access page_1's content from page_2 using a COA_INT. What I want to do is, in Page_2's TypoScript, load page_1's content into template1 if there is content in page_1. Otherwise, load page_2 (and its subpage)'s content into template2. Basically, Page 1 is an override for Page2 (and it's subpages). I need to make it simple enough that the user just has to put content into Page_1 and it will take over. I found a link at http://www.typo3wizard.com/en/snippets/general-config/template-depending-on-right-content.html but unfortunately it refers to columns on the same page - I have columns on different pages. So, my *extremely rough* typoscript for page_2 looks like this:

1= COA_INT
1 {
    10 = CONTENT
    10 {
        table = tt_content
        select {
            pidInList = 55
            orderBy = sorting ASC
        } # end select
    } # end 10
} # end 1

page.19.subparts.OVERRIDE= COA
page.19.subparts.OVERRIDE {
  10 = COA
  10 {
    if.isTrue.numRows < 1
    10 = TEMPLATE
    10 {
      template = FILE
      template.file = fileadmin/emergency.html
    }
  }
  20 = COA
  20 {
    if.isFalse.numRows < 1
    10 = TEMPLATE
    10 {
      template = FILE
      template.file = fileadmin/template.html
    }
  }
}

... and then emergency.html looks like:

<!-- ###DOCUMENT### START -->
<div id="wrapper">
   <div id="override">
      <!-- ###OVERRIDE### START -->


      <!-- ###OVERRIDE### END -->

   </div>
</div>
<!-- ###DOCUMENT### END -->


.... and template.html looks like:

<!-- ###DOCUMENT### START -->
<div id="wrapper">
   <div id="content">
      <!-- ###CONTENT### START -->


      <!-- ###CONTENT### END -->

   </div>
</div>
<!-- ###DOCUMENT### END -->

Can someone please help me fill in the holes?

Thanks as always,
-Scott.


More information about the TYPO3-english mailing list