Typo3 如何让前端布局决定列和后端布局?
有没有办法让前端布局确定后端布局、模板文件和列 目前,我有以下代码,允许您设置后端布局,并使用适当的模板文件。但当每个布局有不同的列位置时,这会变得非常混乱Typo3 如何让前端布局决定列和后端布局?,typo3,typoscript,fluid,typo3-7.6.x,Typo3,Typoscript,Fluid,Typo3 7.6.x,有没有办法让前端布局确定后端布局、模板文件和列 目前,我有以下代码,允许您设置后端布局,并使用适当的模板文件。但当每个布局有不同的列位置时,这会变得非常混乱 page.10 = FLUIDTEMPLATE page.10 { #format = html file= fileadmin/templates/example/partials/example_home.html partialRootPath = fileadmin/templates/example
page.10 = FLUIDTEMPLATE
page.10 {
#format = html
file= fileadmin/templates/example/partials/example_home.html
partialRootPath = fileadmin/templates/example/partials/
layoutRootPath = fileadmin/templates/example/layouts/
variables {
# Assign the Columns
main < styles.content.get
main.select.where = colPos = 0
news < styles.content.get
news.select.where = colPos = 1
}
}
}
# Assign the Template files with the Fluid Backend-Template
page.10.file.stdWrap.cObject = CASE
page.10.file.stdWrap.cObject {
key.data = levelfield:-1, backend_layout_next_level, slide
key.override.field = backend_layout
# Set the default Template
default = TEXT
default.value = fileadmin/templates/example/partials/example_home.html
# Set a second Template
23 = TEXT
23.value = fileadmin/templates/example/partials/example_internal.html
}
一点也不混乱,下面是一个真实世界的例子:
page.10 = FLUIDTEMPLATE
page.10 {
file.stdWrap.cObject = CASE
file.stdWrap.cObject {
key.data = pagelayout
default = TEXT
default.value = {$customPagesTemplatePath}/Standard.html
1 = TEXT
1.value = {$customPagesTemplatePath}/Home.html
2 = TEXT
2.value = {$customPagesTemplatePath}/Landing.html
10 = TEXT
10.value = {$customPagesTemplatePath}/NewsDetail.html
11 = TEXT
11.value = {$customPagesTemplatePath}/LandingMini.html
12 = TEXT
12.value = {$customPagesTemplatePath}/FullWidth.html
}
layoutRootPath = {$customPagesLayoutPath}
partialRootPath = {$customPagesPartialPath}
}
这样想:
就像你说的,忘掉前端布局吧。这是遗产;be布局为be和FE服务
如果一个页面是一个城市,那么colPos就是街道。或者更确切地说,假设后端是您正在绘制的地图,前端是您根据该地图构建的乐高城:-如果可以,我将继续使用该隐喻
ColPos是记录所在页面的确定部分。如果可以,请查看数据库中的tt_content表:您将看到colPos只是一个带有数字的列。所以在城市第一页,有一条叫colPos 7的街道,里面有一些记录,可能是房子。使用TYPO3中的be_布局向导,您将创建该城市的管理地图:编辑器应如何查看这些街道
在根据所选be_布局调用的FLUIDTEMPLATE中,您将创建城市本身;渲染的前端
下面是此类流体模板Home.html的另一个真实示例:
<f:render partial="Mobilenav" />
<f:render partial="Header"/>
<div class="row">
<f:cObject typoscriptObjectPath="lib.home-teaser" />
</div>
<aside>
<div class="row">
<div class="columns">
<div class="row">
<div class="fp-teaser-outer small-48 medium-24 large-12 columns">
<div class="fp-teaser-box-wrapper">
<f:cObject typoscriptObjectPath="lib.home-something" />
</div>
</div>
<div class="fp-teaser-outer small-48 medium-24 large-12 columns">
<div class="fp-teaser-box-wrapper">
<f:cObject typoscriptObjectPath="lib.home-somethingelse" />
</div>
</div>
<div class="fp-teaser-outer small-48 medium-24 large-12 columns">
<div class="fp-teaser-box-wrapper">
<div class="fp-teaser-box">
<f:cObject typoscriptObjectPath="lib.home-news-plugin-title" />
<div class="fp-teaser-hr"></div>
<div class="fp-teaser-content">
<f:cObject typoscriptObjectPath="lib.home-news" />
</div>
</div>
</div>
</div>
<div class="fp-teaser-outer small-48 medium-24 large-12 columns">
<div class="fp-teaser-box-wrapper">
<div class="fp-teaser-box">
<f:cObject typoscriptObjectPath="lib.home-blog-plugin-title" />
<div class="fp-teaser-hr"></div>
<div class="fp-teaser-content">
<f:cObject typoscriptObjectPath="lib.home-blog" />
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</aside>
<f:render partial="Footer"/>
像这样,第七街的所有房子都被放置在城市的这个位置上,并在你的页面中呈现出来。你的问题不是很清楚。您正在使用后端_布局。每个后端布局都可以在FE中有自己的表示。为什么FE布局应该决定BE的外观?我的意思是,通常情况下,这是一个相反的方向。您选择BE布局,它确定列,并为此准备FE视图。在Fluid中,有用于此目的的布局,这样您就可以从模板中提取不同的部分。@AndrásOttó好的,如果我们忘记了前端布局部分,如何根据选择的后端布局设置不同的colPos?@AndrásOttó,如果您有两个使用相同后端布局的不同模板,您会怎么做?我有两个问题:1您可以在一个布局中使用colPos 7中的“home something”,但在另一个布局中使用colPos 6吗?2如果有两个流体模板共享相同的BE布局,您会怎么做?1这只是命名-是。你可以随意设置。你不能在两个不同的地方拥有相同的内容元素/记录。因为你不能在第六街和第七街有相同的房子。不过,你可以在两条街道上建两栋完全相同的房子。或者,在计算过程中,将你的房子从第六街镜像到第七街。2模板只说明内容的呈现方式。您可以为相同的内容制作任意多个模板。您的情况可能是,在某些情况下,您希望将一个模板应用于页面,但在其他情况下,您希望将另一个模板应用于页面?你不知道如何传递信息,使用哪个模板?嗯,你必须在打字稿中加入更多的逻辑;e、 g.如果设置了此GET参数,则选择此不同的BE布局。我建议为此设置一个单独的问题。因此,对于1,你是说我应该简单地为列命名,以特定于它们的模板,例如“home1maincontent”和“home2maincontent”,假设我有两个主页?我不确定你命名列是什么意思。可能是的。标准答案是,如果它对你有用,那就好了。我建议你多了解流体/打字稿的背景知识,这样一切都会变得更清晰。或者练习,这就是你正在做的。只要继续试验:-
lib.home-something < styles.content.get
lib.home-something {
select.where = colPos = 7
}
<f:cObject typoscriptObjectPath="lib.home-something" />