2016-01-14 169 views
0

我試圖使用t3onepage擴展略有修改,但似乎無法讓它的工作。該擴展只適用於單級後端頁面結構,但我希望能夠添加子頁面。Typo3單頁內容呈現

在後臺我希望有一個乾淨,易於使用的頁面結構是這樣的:

Level 1 
    Level 2 
    Level 2 
    Level 1 
    Level 1 
    Level 2 

這是相當標準。此擴展程序收集所有這些頁面的所有內容,並將它們合併到一個頁面中。我只是在獲取Level 2內容時遇到問題。 這裏是獲取所有Level 1頁面的擴展代碼,但是如何爲Level 2做到這一點?

20 = CONTENT 
20 { 
    table = pages 
    select.orderBy = sorting 

    renderObj = COA 
    renderObj { 
     10 = CONTENT 
     10 { 
      table = tt_content 
      select { 
       pidInList.field = uid 
       orderBy = sorting 
       where = colPos = 0 
      } 

      wrap = <section id="{field:css_id}" class="{field:css_class}">|</section> 
      wrap.insertData = 1 
     } 
    } 

    wrap = <main role="main">|</main> 
} 

生成的HTML代碼看起來是這樣的:

<section ids, etc>Level 1</section> 
<section ids, etc>Level 1</section> 
<section ids, etc>Level 1</section> 

,我想它有類似:

<section ids, etc>Level 1</section> 
<section ids, etc>Level 2</section> 
<section ids, etc>Level 2</section> 
<section ids, etc>Level 1</section> 
<section ids, etc>Level 1</section> 
<section ids, etc>Level 2</section> 

任何幫助將非常感激。

回答

0

使用此TypoScript添加子頁面的內容。你需要在第一個renderObj中放置另一個CONTENT。

lib.onepage { 
    20 = CONTENT 
    20 { 
     table = pages 
     select.orderBy = sorting 
     renderObj = COA 
     renderObj { 
     10 = CONTENT 
     10 { 
      table = tt_content 
      select { 
       pidInList.field = uid 
       orderBy = sorting 
       where = colPos = 0 
      } 
      wrap = <section id="{field:css_id}" class="{field:css_class}">|</section> 
      wrap.insertData = 1 
     } 
     20 = CONTENT 
     20 { 
      table = pages 
      select { 
       orderBy = sorting 
       pidInList.field = uid 
      } 
      renderObj = COA 
      renderObj { 
       10 = CONTENT 
       10 { 
        table = tt_content 
        select { 
        pidInList.field = uid 
        orderBy = sorting 
        where = colPos = 0 
        } 
        wrap = <section id="{field:css_id}" class="{field:css_class}">|</section> 
        wrap.insertData = 1 
       } 
      } 
      wrap = <main role="main">|</main> 
     } 
    } 
} 
+0

@MarkusSchwemer非常感謝你,那正是我想要的。現在我用下面的方式包裝整個renderObj: wrap =

|
它的工作原理就是我所需要的。 – user3804467