0
votes

I have a onepage-layout and every page from the backend is a section of this frontend-page. Every section/backendpage has its own layout. The following script choose the correct layout:

20 = FLUIDTEMPLATE
      20 {
            file.cObject = CASE
            file.cObject {
                key.field = uid

                5 = TEXT
                5.value = fileadmin/template/green.html

                6 = TEXT
                6.value = fileadmin/template/blue.html

                default = TEXT
                default.value = fileadmin/template/default.html
            }

This works fine. Now I need the correct content in every section. I tried the following:

        variables {
                content < styles.content.get
                content{
                    select {
                        pidInList = 5
                        #pidInList = uid
                        where = colPos= 0 
                        #where = colPos={field: colPos}

                        orderBy = sorting
                    }
                }
            }

Setting pidInList to a static value like 5 works. But I need the correct content to the choosen layout-file. Why is uid not working?

Here is the complete block:

lib.sectionContent = HMENU
lib.sectionContent {
  1 = TMENU
  1 {
    NO = 1
    NO {
      doNotLinkIt = 1
      stdWrap >
      stdWrap {
        cObject = COA
        cObject {
          if.value = 5
          if.equals.field = doktype
          if.negate = 1
          10 < temp.titleSectionId
          10.wrap = <div id="|">


          20 = FLUIDTEMPLATE
          20 {
                file.cObject = CASE
                file.cObject {
                    key.field = uid

                    5 = TEXT
                    5.value = fileadmin/template/green.html

                    6 = TEXT
                    6.value = fileadmin/template/blue.html

                    default = TEXT
                    default.value = fileadmin/template/default.html
                }

                variables {
                    content < styles.content.get
                    content{
                        select {
                            pidInList.field = uid

                            where = colPos= 0 
                            #where = colPos={field: colPos}

                            orderBy = sorting
                        }
                    }
                }
          }
          30 = TEXT
          30 {
            wrap = </div>
          }
        }
      }
    }
  }
}

This one always choose the default value :-(

            variables {
                content < styles.content.get
                content{
                    select {
                        pidInList.cObject = CASE
                        pidInList.cObject {
                            key.field = uid

                            5 = TEXT
                            5.value = 5

                            default = TEXT
                            default.value = 10
                        }
                    }
                }
            }
1

1 Answers

0
votes

as you use the uid in the template part:

key.field = uid

you need to specify the usage of the field uid for the content selection:

pidInList.field = uid

BTW in this way you have the templating hardcoded assigned to the pages.
Be aware of the fields layout and backend_layout, so an editor may select a layout for each page individually from a pool of templates.

Meanwhile I'm not sure about the possibility to select a field for pidInList directly.
but there is an alternative: markers
for selects you have the option to use and define markers for more readability.

select {
    pidInList = ###pageUid###
    #where  - already set by styles.content.get
    #orderBy - already set by styles.content.get
    markers {
      pageUid.field = uid
    }
  }