Typo3 OnePager使用FluidTemplate加载内容

时间:2019-01-06 11:30:46

标签: templates typo3 typoscript

我正在此Blog Post的帮助下创建Typo3 OnePager网站。它将根页面的所有子页面作为OnePager中的部分加载。这项工作如前所述,但仅直接从tt_content而不是通过Fluidtemplate加载内容。我希望它与Fuildtemplate一起加载,因为我可以在后端选择几个不同的模板。

因此,整个TS(用于加载内容和模板)如下所示:

lib.sectionContent = HMENU
lib.sectionContent {
  1 = TMENU
  1 {
    NO = 1
    NO {
      doNotLinkIt = 1
      stdWrap >
      stdWrap {
        cObject = COA
        cObject {
          if.value = 4
          if.equals.field = doktype
          if.negate = 1
          10 < temp.titleSectionId
          10.wrap = <section id="|">
          20 = CONTENT
          20 < styles.content.get
          20 {
                table = tt_content
                select.where.field = column
                select.where.wrap = colPos = |
            }
          }
          30 = TEXT
          30 {
            wrap = </section>
          }
        }
      }
    }
  }
}

lib.mainTemplate = FLUIDTEMPLATE
lib.mainTemplate{

        templateName = TEXT
        templateName.stdWrap{
            cObject = TEXT
            cObject{
               data = levelfield:-2,backend_layout_next_level,slide
                override.field = backend_layout
                split {
                    token = pagets__
                    1.current = 1
                    1.wrap = |
            }
        }   
        ifEmpty = contentPage1column
    }

    templateRootPaths {
    10 = {$path.privat}Templates/Page/
    }
    layoutRootPaths {
        10 = {$path.privat}Layouts/Page/
    }
    partialRootPaths {
        10 = {$path.privat}Partials/Page/
    }

}

在模板中,我用

加载内容

<f:format.raw><f:cObject typoscriptObjectPath="lib.sectionContent" data="{column:0}" /></f:format.raw>

但是当我尝试加载FE时,出现此错误:

执行'SELECT * FROM tt_content WHERE(tt_contentpid IN(1))AND(colPos =)AND(tt_content。{{ 1}} = 0)AND(({sys_language_uidtt_content = 0)AND(deletedtt_content <= 0)AND(t3ver_state。{{ 1}} <> -1)AND(tt_contentpid = 0)AND(tt_contenthidden <= 1546847160)AND((tt_content starttime = 0)或(tt_contentendtime> 1546847160))AND((((tt_contentendtime ='')OR({{1} }。tt_content为NULL)OR(fe_grouptt_content ='0')OR(FIND_IN_SET('0',fe_grouptt_content))OR (FIND_IN_SET('-1',fe_grouptt_content))))))ORDER BY fe_group ASC':您的SQL语法有误;检查与您的MariaDB服务器版本相对应的手册,以在')AND(tt_contentfe_group = 0)AND(({sortingtt_content = 0)第1行的AN'

我在做什么错了?

谢谢!

1 个答案:

答案 0 :(得分:1)

如您所见,查询中的列没有值:

[...] WHERE (tt_content.pid IN (1)) AND (colPos =) AND [...]
                                                 ^

,以及当您检查在哪里建立查询时:

lib.sectionContent = HMENU
lib.sectionContent {
  1 = TMENU
  1 {
    NO = 1
    NO {
      stdWrap {
        cObject = COA
        cObject {
          20 = CONTENT
          20 {
            select.where.field = column
            select.where.wrap = colPos = |
            :

您可以看到上下文是一个TMENU。那里有pages条记录作为当前数据。并且在pages中没有字段column

您可以将lib.sectionContent更改为带有第一项的COA,以将“参数” column存储到寄存器中,以后可以用作register:column

lib.sectionContent = COA
lib.sectionContent {
  10 = LOAD_REGISTER
  10 {
    column.cObject = TEXT
    column.cObject.field = column
  }
  20 = HMENU
  20 {
    :
          select.where.data = register:column
          select.where.wrap = colPos = |
    :