如何将 html 模板集成到 Typ3 [英] How to integrate a html template to typo3
问题描述
我是typo3 的新手,我想在其中集成我的HTML 模板.但我无法将我的内容添加到页面中,我得到的只是一个空白页面.
我使用的是 TYPO3 v8
您好!
TYPO3 8 中模板集成需要做的步骤
TYPOSCRIPT
告诉 TYPO3 模板的获取位置.
page = PAGE第10页{模板根路径{10 = 模板路径}布局根路径{10 = 布局路径}部分根路径{10 = 通往您的零件的路径}模板名称 = 文本模板名称.stdWrap {cObject = 文本对象{数据 = levelfield:-2,backend_layout_next_level,slideoverride.field = backend_layout分裂 {令牌 = pagets__1.电流 = 11.包裹= |}}ifEmpty = 主页}}
布局
创建布局不是必需的,但我建议您这样做,如果您只有一种类型的模板.
布局(在TYPO3中称为Backend Layouts)可以在TYPO3后端创建,后端布局保存在数据库中.但是您可以将后端布局配置保存在一个文件中.
<块引用>提示:尝试将后端布局配置保存在文件中,以便您可以添加到混蛋
后端布局配置示例:
mod.web_layout.BackendLayouts {Home # 以此名称标识{title = Home # 当您选择布局时,这会显示在后端图标 = EXT:example_extension/Resources/Public/Images/BackendLayouts/default.gif配置{后端布局{列数 = 1行数 = 1行{1 {列 {1 {名称 = 内容colPos = 1 # 这很重要,我在下面谈论 colPos}}}}}}}}
<块引用>
ColPos 含义:一个布局中可以有多个列,colPos 用于在前端渲染内容.这是稍后将在模板 <f:cObject TypscriptObjectPath="lib.dynamicContent" data="{colPos: 1}"/>
以上配置应该包含在PageTs中.如果您编辑页面并转到资源"选项卡,就会找到此信息.
lib.dynamicContent
lib.dynamicContent = COAlib.dynamicContent {5 = 加载_注册5 {colPos.cObject = 文本colPos.cObject {字段 = colPosifEmpty.cObject = TEXTifEmpty.cObject {值.current = 1如果空 = 0}}pageUid.cObject = TEXTpageUid.cObject {字段 = pageUidifEmpty.data = TSFE:id}contentFromPid.cObject = TEXTcontentFromPid.cObject {数据 = DB:pages:{register:pageUid}:content_from_pid数据.插入数据 = 1}wrap.cObject = 文本wrap.cObject {字段 = 换行}maxItems.cObject = 文本maxItems.cObject {字段 = maxItems如果为空 =}}20 = 内容20{表 = tt_content选择 {includeRecordsWithoutDefaultTranslation = 1orderBy = 排序其中 = {#colPos}={register:colPos}where.insertData = 1pidInList.data = register:pageUidpidInList.override.data = register:contentFromPidmax.data = register:maxItems//如果您在 TYPO3 中使用此排版文字,则需要 select.languageField 设置v7//语言字段 = sys_language_uid}标准包装{dataWrap = {注册:包装}需要 = 1}}90 = RESTORE_REGISTER}lib.dynamicContentSlide
主页布局 html 集成
主页模板集成
<f:section name="内容">//内容<f:cObject TypscriptObjectPath="lib.dynamicContent" data="{colPos: 1}"/></f:section>
现在我们已经设置了布局和模板.希望你有 TYPO3 的基本设置(至少有一个根页面和一个模板设置)
如果您还没有此设置,请按照以下步骤操作:
- 创建根页面
- 使用根页面上的列表
- 创建模板记录 - 进入选项选项卡并检查
Clear ->常量
和Clear ->设置
并检查Rootlevel
- 进入
Includes
选项卡并从多个选择框fluid_styled_content
中选择 - 在创建的模板中粘贴
TYPOSCRIPT 配置
(检查常规选项卡)
编辑根页面并转到外观选项卡以选择后端布局.
I'am new to typo3 and I want to integrate my HTML template in it. but I can't add my content to the pages threw the dashboard all I get is a blank page.
I'am using TYPO3 v8
Greetings!
The steps you need to do for template integration in TYPO3 8
TYPOSCRIPT
Tell TYPO3 by where the templates should be get.
page = PAGE
page.10 {
templateRootPaths {
10 = PATH TO YOUR TEMPLATES
}
layoutRootPaths {
10 = PATH TO YOUR LAYOUTS
}
partialRootPaths {
10 = PATH TO YOUR PARTIALS
}
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 = Home
}
}
LAYOUTS
It's not required to create a layout, but i suggest to do it, also if you have just one type of template.
The layouts ( in TYPO3 called Backend Layouts ) can be created in TYPO3 backend and the backend layouts are saved in database. But you can save the backend layouts configuration in a file.
Hint: Try save the backend layouts configuration in files so you can add to git
Example of backend layout configuration:
mod.web_layout.BackendLayouts {
Home # identified by this name {
title = Home # this is shown in backend when you select the layout
icon = EXT:example_extension/Resources/Public/Images/BackendLayouts/default.gif
config {
backend_layout {
colCount = 1
rowCount = 1
rows {
1 {
columns {
1 {
name = Content
colPos = 1 # this is important, i'm talking about colPos below
}
}
}
}
}
}
}
}
ColPos meaning: you can have multiple columns in a layout, and the colPos is used to render the content in frontend. This is what will be used later in template
<f:cObject typoscriptObjectPath="lib.dynamicContent" data="{colPos: 1}" />
The above configuration should be included in PageTs. This is found if you edit a page and go to Resources tab.
Typoscript configuration of lib.dynamicContent
lib.dynamicContent = COA
lib.dynamicContent {
5 = LOAD_REGISTER
5 {
colPos.cObject = TEXT
colPos.cObject {
field = colPos
ifEmpty.cObject = TEXT
ifEmpty.cObject {
value.current = 1
ifEmpty = 0
}
}
pageUid.cObject = TEXT
pageUid.cObject {
field = pageUid
ifEmpty.data = TSFE:id
}
contentFromPid.cObject = TEXT
contentFromPid.cObject {
data = DB:pages:{register:pageUid}:content_from_pid
data.insertData = 1
}
wrap.cObject = TEXT
wrap.cObject {
field = wrap
}
maxItems.cObject = TEXT
maxItems.cObject {
field = maxItems
ifEmpty =
}
}
20 = CONTENT
20 {
table = tt_content
select {
includeRecordsWithoutDefaultTranslation = 1
orderBy = sorting
where = {#colPos}={register:colPos}
where.insertData = 1
pidInList.data = register:pageUid
pidInList.override.data = register:contentFromPid
max.data = register:maxItems
// select.languageField setting is needed if you use this typoscript in TYPO3 < v7
// languageField = sys_language_uid
}
stdWrap {
dataWrap = {register:wrap}
required = 1
}
}
90 = RESTORE_REGISTER
}
lib.dynamicContentSlide < lib.dynamicContent
lib.dynamicContentSlide.20.slide = -1
lib.dynamicContentFirst < lib.dynamicContent
lib.dynamicContentFirst.20.select.max = 1
Home layout html integration
<f:render section="main" />
Home template integration
<f:layout name="Home" />
<f:section name="content">
// content
<f:cObject typoscriptObjectPath="lib.dynamicContent" data="{colPos: 1}" />
</f:section>
Now we have the setup of layouts and templates. Hope that you have a basic setup of TYPO3 ( a root page at least and a template setup )
If you don't have this setup already, follow the next steps:
- Create a root page
- Go with list on root page
- Create a Template record - go in Options tab and check
Clear -> Constants
andClear -> setup
and check alsoRootlevel
- Go in
Includes
tab and select from the multiple selectboxfluid_styled_content
- Paste the
TYPOSCRIPT configuration
in the created template ( check General Tab )
Edit Root page and go to the Appearance tab to select the Backend Layout.
这篇关于如何将 html 模板集成到 Typ3的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!