3

我一直在寻找,但还没有找到可以工作的东西......

TYPO3 8.7.8

root           - backend-layout ("Main") for this and all subpages   (id=1)
|
 - home        - backend-layout ("Home") for this page only          (id=2)
|
 - subpage     - same backend-layout as root                         (id=3)

两个后端布局看起来都一样:

________________________________
|             Top              |
|______________________________|
| main-content | right-content |
|______________|_______________|

顶部的名称不同,使用方式也不同。

“主要”后端布局的顶部应该只允许图像内容元素。

cType.allowed = image

“Home”-backend-layout 的顶部应该只允许 text-content-element

cType.allowed = text

我试过的最后两件事是

第一:使用打字稿中的 GlobalVars 限制它

[globalVar = TSFE:id != 2]&&[globalVar = TSFE:colPos=2]
  TCEFORM.tt_content.CType.removeItems := addToList(header,text,bullets,table,uploads,multimedia,mailform,search,login,splash,menu,shortcut,list,script,div,html,media)
  TCEFORM.tt_content.CType.keepItems := addToList(image)
[end]

第二:改变数据库中布局的属性

backend_layout {
    colCount = 2
    rowCount = 2
    rows {
        1 {
            columns {
                1 {
                    name = Parallax
                    colspan = 2
                    colPos = 2
                    # The following 3 lines have been added through me
                    cType {
                        allowed = text
                    }
                }
            }
        }
        2 {
            columns {
                1 {
                    name = Content-Main
                    colPos = 0
                }
                2 {
                    name = Content-Right
                    colPos = 1
                }
            }
        }
    }
}

我已经尝试了很多其他的东西,但我不确定我是否会再次找到它们。我什至不确定这可以在 TYPO3 8.x 中完成。以错字创建后端布局的选项确实受到限制。您只能键入列的名称并定义 colPos。

我对 TYPO3 8.x 做错了什么,我的配置不起作用吗?我需要不同的属性吗?或者它只是不打算在这个版本的 TYPO3 中再以这种方式工作?因为它似乎以前奏效过……

我还是 TYPO3 的新手,非常感谢您的帮助,但要具体说明在哪里更改,否则我会再次迷路.... ^^

谢谢!

4

3 回答 3

3

感谢 Joey,我找到了可以使用的扩展:Content Defender

我发现了如何通过 ts 添加我的 backend_layouts;将以下内容添加到根页面的PageTS

mod.web_layout.BackendLayouts {
   Home {
      title = Home
      config {
        backend_layout {
          colCount = 2
          rowCount = 2
          rows {
            1 {
              columns {
                1 {
                  name = Parallax
                  colspan = 2
                  colPos = 2
                  # allowed and disallowed only work through the extension content_defender (or gridelements)
                  allowed {
                    CType = gi_customstyler_parallax_content
                  }
                }
              }
            }
            2 {
              columns {
                1 {
                  name = Main
                  colPos = 0
                  disallowed {
                    CType = gi_customstyler_bg_image,gi_customstyler_parallax_content
                  }
                }
                2 {
                  name = Right
                  colPos = 1
                  disallowed {
                    CType = gi_customstyler_bg_image,gi_customstyler_parallax_content
                  }
                }
              }
            }
          }
        }
     }
  }
  Main {
      title = Main
      config {
        backend_layout {
          colCount = 2
          rowCount = 2
          rows {
            1 {
              columns {
                1 {
                  name = Titel-Hintergrund
                  colspan = 2
                  colPos = 2
                  allowed {
                    CType = gi_customstyler_bg_image
                  }
                }
              }
            }
            2 {
              columns {
                1 {
                  name = Main
                  colPos = 0
                  disallowed {
                    CType = gi_customstyler_bg_image,gi_customstyler_parallax_content
                  }
                }
                2 {
                  name = Right
                  colPos = 1
                  disallowed {
                    CType = gi_customstyler_bg_image,gi_customstyler_parallax_content
                  }
                }
              }
            }
          }
        }
     }
  }
}

这样,两个 backend_layouts 在页面配置上可用,并具有受限内容元素的附加条件。如您所见,这也可以与自定义内容元素一起使用。

我花了很长时间才弄清楚这一点(作为新手),我希望这可能对其他人有所帮助......

于 2017-11-28T14:22:52.003 回答
2

尝试这样的事情:

    backend_layout {
      colCount = 2
      rowCount = 2
      rows {
        1 {
          columns {
            1 {
              name = Parallax
              colspan = 2
              colPos = 2
              allowed = text
            }
          }
        }
        2 {
          columns {
            1 {
              name = Content-Main
              colPos = 0
            }
            2 {
              name = Content-Right
              colPos = 1
            }
          }
        }
      }
    }
于 2017-11-21T15:52:43.557 回答
2

你在好的路上,但条件不正确。

问题一:BE 没有可用的 TSFE。

在 "globalString" 条件下,键 "TSFE:" 将不起作用,因为 TSFE 全局对象仅存在于 FE 上下文中。“LIT:”键也不起作用,因为它用于比较在 BE 上下文中不可用的 TypoScript 常量。

参考:https ://docs.typo3.org/typo3cms/TSconfigReference/Conditions/Index.html

您需要使用“页面”而不是“TSFE:page|”。这些是相等的,但是“page”可以用于前端和后端,但“TSFE”仅用于前端。

第二个问题是,对于 colPos,您需要访问 GP (GetPost) 助手而不是 TSFE。

所以尝试像这样改变条件:

[page|uid != 2]&&[globalVar = GP:colPos==2]
  TCEFORM.tt_content.CType.removeItems := addToList(header,text,bullets,table,uploads,multimedia,mailform,search,login,splash,menu,shortcut,list,script,div,html,media)
  TCEFORM.tt_content.CType.keepItems := addToList(image)
[end]

注意:BE 布局没有 CType 限制,因此“cType”和“allowed”都是错误的。

于 2017-11-22T06:55:09.523 回答