TYPO3 FLUID 空白页 TYPO3
TYPO3 FLUID blank page TYPO3
我尝试创建我的第一个 FLUIDTEMPLATE。但是方法
f:layout
不要激活。
我的结构:
/fileadmin/
/fileadmin/layouts/layout.html
/fileadmin/partials/
/fileadmin/styles/
/fileadmin/templates/template.html
/fileadmin/typoscript/
/fileadmin/typoscript/01_script/setup.ts
/fileadmin/typoscript/02_object/
setup.ts:
page = PAGE
page.typeNum = 0
page.10 = FLUIDTEMPLATE
page.10 {
format = html
file = fileadmin/templates/layouts/layout.html
partialRootPath = fileadmin/templates/partials/
layoutRootPath = fileadmin/templates/layouts/
variables {
content_main < styles.content.get
content_main.select.where = colPos = 0
}
}
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
default = TEXT
default.value = fileadmin/templates/template.html
}
Layout.html:
<div id="wrapper">
<div id="header">
header
</div>
<div id="top_nav">
top_nav
</div>
<div id="left">
left
</div>
<div id="right">
right
</div>
<div id="center">
center
</div>
<div id="footer">
footer
</div>
</div>
template.html:
<f:layout name = "Layout" />
模板设置:
<INCLUDE_TYPOSCRIPT: source ="DIR:fileadmin/typoscript/">
现在,如果我查看网页,我只会看到一个空白页面。如果我查看代码,我会得到:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<!--
This website is powered by TYPO3 - inspiring people to share!
TYPO3 is a free open source Content Management Framework initially created by Kasper Skaarhoj and licensed under GNU/GPL.
TYPO3 is copyright 1998-2017 of Kasper Skaarhoj. Extensions are copyright of their respective owners.
Information and contribution at https://typo3.org/
-->
<title>Fluid</title>
<meta name="generator" content="TYPO3 CMS">
<link rel="stylesheet" type="text/css" href="typo3temp/Assets/b9db200ac9.css?1491821607" media="all">
</head>
<body>
<f:layout name = "Layout" />
</body>
</html>
我正在使用 TYPO3 v7.6.16。
模板: Startseite.html
<f:layout name="Default" />
<f:section name="body">
<div id="wrapper">
<div id="header">
{header->f:format.raw()}
</div>
<div id="top_nav">
{top_nav->f:format.raw()}
</div>
<div id="left">
{left->f:format.raw()}
</div>
<div id="right">
{right->f:format.raw()}
</div>
<div id="center">
{center->f:format.raw()}
</div>
<div id="footer">
{footer->f:format.raw()}
</div>
</div>
</f:section>
您可以为内页(Inhaltsseite)布局配置相同的。
布局: Default.html
<f:render section="body" />
错别字: (setup.ts)
lib.pageTemplate = FLUIDTEMPLATE
lib.pageTemplate {
templateName = TEXT
templateName.stdWrap.cObject = CASE
templateName.stdWrap.cObject {
key.field = backend_layout
# @todo: setup all page templates
default = TEXT
default.value = Startseite
1 = TEXT
1.value = Inhaltsseite
}
templateRootPaths {
10 = fileadmin/templates/Resources/Private/Templates/
}
partialRootPaths {
10 = fileadmin/templates/Resources/Private/Partials/
}
layoutRootPaths {
10 = fileadmin/templates/Resources/Private/Layouts/
}
variables {
content = CONTENT
content {
table = tt_content
select.orderBy = sorting
slide = -1
select.where = colPos=0
}
}
}
# Page setup Configuration
page = PAGE
page {
# Your TypeNum
typeNum = 0
#Include header data if any
headerData{
}
#Include website meta
meta{
}
#Include stylesheet
includeCSS {
}
#Include Js files(In the header)
includeJS {
}
#Include Js in footer
includeJSFooter {
}
# assign template (copy fluid template object)
10 < lib.pageTemplate
}
在模板中包含 setup.ts->include->BE 中的setup.ts。
<INCLUDE_TYPOSCRIPT:source="FILE:fileadmin/templates/Configuration/TypoScript/setup.ts" />
您好!
您的示例代码存在几个问题。让我们来看看它们:
- 你不应该把你的模板放在 fileadmin 中(默认情况下)它们可以通过网络请求访问并且可以由编辑器编辑。而是将它们放在
Resources/Private/
. 下的扩展中
您不应将布局文件指定为模板。你有
文件=fileadmin/templates/layouts/layout.html
您应该指向 Resources/Private/Templates
中的 Template.html 之类的模板,而不是 layout.html
- 然后您可以在您的模板中包含一个布局文件。但是删除空格:
<f:layout name="Layout" />
.
- 为您的模板、布局和部分文件使用大写名称(
Template.html
而不是 template.html
)。
- 改用
templateRootPaths
、layourRootPaths
和partialRootpaths
。
因此您的 TypoScript 可能如下所示:
page.10 = FLUIDTEMPLATE
page.10 {
format = html
file = EXT:my_ext/Resources/Private/Templates/Template.html
partialRootPaths {
10 = EXT:my_ext/Resources/Private/Partials/
}
layoutRootPaths {
10 = EXT:my_ext/Resources/Private/Layouts/
}
templateRootPaths
10 = EXT:my_ext/Resources/Private/Templates/
}
variables {
content_main < styles.content.get
content_main.select.where = colPos = 0
}
}
你首先必须在打字错误中创建一个页面对象(上面的打字错误中没有):
页 = 页
这应该是您打字错误的第一行。
我尝试创建我的第一个 FLUIDTEMPLATE。但是方法
f:layout
不要激活。
我的结构:
/fileadmin/
/fileadmin/layouts/layout.html
/fileadmin/partials/
/fileadmin/styles/
/fileadmin/templates/template.html
/fileadmin/typoscript/
/fileadmin/typoscript/01_script/setup.ts
/fileadmin/typoscript/02_object/
setup.ts:
page = PAGE
page.typeNum = 0
page.10 = FLUIDTEMPLATE
page.10 {
format = html
file = fileadmin/templates/layouts/layout.html
partialRootPath = fileadmin/templates/partials/
layoutRootPath = fileadmin/templates/layouts/
variables {
content_main < styles.content.get
content_main.select.where = colPos = 0
}
}
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
default = TEXT
default.value = fileadmin/templates/template.html
}
Layout.html:
<div id="wrapper">
<div id="header">
header
</div>
<div id="top_nav">
top_nav
</div>
<div id="left">
left
</div>
<div id="right">
right
</div>
<div id="center">
center
</div>
<div id="footer">
footer
</div>
</div>
template.html:
<f:layout name = "Layout" />
模板设置:
<INCLUDE_TYPOSCRIPT: source ="DIR:fileadmin/typoscript/">
现在,如果我查看网页,我只会看到一个空白页面。如果我查看代码,我会得到:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<!--
This website is powered by TYPO3 - inspiring people to share!
TYPO3 is a free open source Content Management Framework initially created by Kasper Skaarhoj and licensed under GNU/GPL.
TYPO3 is copyright 1998-2017 of Kasper Skaarhoj. Extensions are copyright of their respective owners.
Information and contribution at https://typo3.org/
-->
<title>Fluid</title>
<meta name="generator" content="TYPO3 CMS">
<link rel="stylesheet" type="text/css" href="typo3temp/Assets/b9db200ac9.css?1491821607" media="all">
</head>
<body>
<f:layout name = "Layout" />
</body>
</html>
我正在使用 TYPO3 v7.6.16。
模板: Startseite.html
<f:layout name="Default" />
<f:section name="body">
<div id="wrapper">
<div id="header">
{header->f:format.raw()}
</div>
<div id="top_nav">
{top_nav->f:format.raw()}
</div>
<div id="left">
{left->f:format.raw()}
</div>
<div id="right">
{right->f:format.raw()}
</div>
<div id="center">
{center->f:format.raw()}
</div>
<div id="footer">
{footer->f:format.raw()}
</div>
</div>
</f:section>
您可以为内页(Inhaltsseite)布局配置相同的。
布局: Default.html
<f:render section="body" />
错别字: (setup.ts)
lib.pageTemplate = FLUIDTEMPLATE
lib.pageTemplate {
templateName = TEXT
templateName.stdWrap.cObject = CASE
templateName.stdWrap.cObject {
key.field = backend_layout
# @todo: setup all page templates
default = TEXT
default.value = Startseite
1 = TEXT
1.value = Inhaltsseite
}
templateRootPaths {
10 = fileadmin/templates/Resources/Private/Templates/
}
partialRootPaths {
10 = fileadmin/templates/Resources/Private/Partials/
}
layoutRootPaths {
10 = fileadmin/templates/Resources/Private/Layouts/
}
variables {
content = CONTENT
content {
table = tt_content
select.orderBy = sorting
slide = -1
select.where = colPos=0
}
}
}
# Page setup Configuration
page = PAGE
page {
# Your TypeNum
typeNum = 0
#Include header data if any
headerData{
}
#Include website meta
meta{
}
#Include stylesheet
includeCSS {
}
#Include Js files(In the header)
includeJS {
}
#Include Js in footer
includeJSFooter {
}
# assign template (copy fluid template object)
10 < lib.pageTemplate
}
在模板中包含 setup.ts->include->BE 中的setup.ts。
<INCLUDE_TYPOSCRIPT:source="FILE:fileadmin/templates/Configuration/TypoScript/setup.ts" />
您好!
您的示例代码存在几个问题。让我们来看看它们:
- 你不应该把你的模板放在 fileadmin 中(默认情况下)它们可以通过网络请求访问并且可以由编辑器编辑。而是将它们放在
Resources/Private/
. 下的扩展中
您不应将布局文件指定为模板。你有
文件=fileadmin/templates/layouts/layout.html
您应该指向 Resources/Private/Templates
- 然后您可以在您的模板中包含一个布局文件。但是删除空格:
<f:layout name="Layout" />
. - 为您的模板、布局和部分文件使用大写名称(
Template.html
而不是template.html
)。 - 改用
templateRootPaths
、layourRootPaths
和partialRootpaths
。
因此您的 TypoScript 可能如下所示:
page.10 = FLUIDTEMPLATE
page.10 {
format = html
file = EXT:my_ext/Resources/Private/Templates/Template.html
partialRootPaths {
10 = EXT:my_ext/Resources/Private/Partials/
}
layoutRootPaths {
10 = EXT:my_ext/Resources/Private/Layouts/
}
templateRootPaths
10 = EXT:my_ext/Resources/Private/Templates/
}
variables {
content_main < styles.content.get
content_main.select.where = colPos = 0
}
}
你首先必须在打字错误中创建一个页面对象(上面的打字错误中没有): 页 = 页 这应该是您打字错误的第一行。