0
votes

I'm creating a Typo3 OnePager Website with help of this Blog Post. It loads all the subpages of the root page as sections in the OnePager. This work as explained, but it only loads the content directly from tt_content and not via Fluidtemplate. I want it to load with Fuildtemplate because I have several different templates which can be selected in the backend.

So the whole TS, that loads the content and the template looks like this:

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/
    }

}

In the template I load the content with

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

But when I try to load the FE, then I get this Error:

An exception occurred while executing 'SELECT * FROM tt_content WHERE (tt_content.pid IN (1)) AND (colPos =) AND (tt_content.sys_language_uid = 0) AND ((tt_content.deleted = 0) AND (tt_content.t3ver_state <= 0) AND (tt_content.pid <> -1) AND (tt_content.hidden = 0) AND (tt_content.starttime <= 1546847160) AND ((tt_content.endtime = 0) OR (tt_content.endtime > 1546847160)) AND (((tt_content.fe_group = '') OR (tt_content.fe_group IS NULL) OR (tt_content.fe_group = '0') OR (FIND_IN_SET('0', tt_content.fe_group)) OR (FIND_IN_SET('-1', tt_content.fe_group))))) ORDER BY sorting ASC': You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ') AND (tt_content.sys_language_uid = 0) AND ((tt_content.deleted = 0) AN' at line 1

What am I doing wrong?

Thanks!

1
You are querying a templateName! Why is it that complex to get a simple name? It looks like you mix name and content.Blcknx
yes you're right. I've change the TS, so that the lib.sectionContent should load the content and then the lib.mainTemplate should get the template name from the backend. I updated it in my post. I assume the thing that I got wrong is the part wehre I actually load the content with styles.content.get but im not sure how to fix it.Eluvitie

1 Answers

1
votes

as you can see there is no value for the column in the query:

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

and when you inspect where you build up your query:

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 = |
            :

you can see the context is a TMENU. There you have a pages record as current data. And in pages there is no field column.

you might change your lib.sectionContent to a COA with the first entry to store the 'parameter' column into a register, which you later can use as 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 = |
    :