我有一个具有以下页面结构的TYPO3页面:
-top level
-sub level 1
-sub level ...
-sub level n
在顶层,我将预览1级到n级,包括链接。
我想获取每个子页面的页面标题,并从第一个内容元素(即常规文本/图像)中获取第一个图像。
因此,每次加载顶层页面时,都应获取数据并动态呈现顶层页面的内容。
有可能吗?
更新:
因此,我需要为要将其后缀显示为预告片的页面制作扩展模板?
temp.unterseiten = CONTENT
temp.unterseiten {
table = pages
select {
pidInList.field = uid
orderBy = sorting
}
renderObj = COA
renderObj {
10 = TEXT
10.field = title
10.wrap = <h2>|</h2>
20 = CONTENT
20 {
table = tt_content
select {
pidInList.field = uid
orderBy = sorting
}
}
}
}
temp.kumulierterInhalt = COA
temp.kumulierterInhalt {
10 = TEXT
10.field = title
10.wrap = <h1>|</h1>
20 = CONTENT
20 {
table = tt_content
select {
orderBy = sorting
}
}
30 < temp.unterseiten
30.renderObj {
30 < temp.unterseiten
30.renderObj {
10.wrap = <h3>|<h3>
30 < temp.unterseiten
30.renderObj {
10.wrap = <h4>|<h4>
}
}
}
}
,我可以在设置中添加此代码吗?以及如何选择要将内容发布到的列?
我这样尝试过:
什么都没显示
从主页进行设置
page = PAGE
page {
config.simulateStaticDocuments = 0
config.baseURL = http://
config.tx_realurl_enable = 1
config.linkVars = L(0-1)
config.doctype = html5
meta.revisit-after = 7 days
meta.robots = all
meta.rating = general
meta.viewport = width=device-width, initial-scale=1, maximum-scale=1
meta.PAGE-TOPIC = Information
meta.PAGE-TYPE = Information
shortcutIcon = fileadmin/design/images/favicon.ico
includeCSS {
screen1 = fileadmin/design/css/bootstrap.css
screen1.title = display
screen1.media = screen
screen2 = fileadmin/design/css/style.css
screen2.title = display
screen2.media = screen
screen3 = fileadmin/design/css/font-awesome.min.css
screen3.title = display
screen3.media = screen
screen4 = fileadmin/design/css/lightbox.min.css
screen4.title = display
screen4.media = screen
}
includeJS {
file1 = fileadmin/design/js/jquery-2.2.0.min.js
file2 = fileadmin/design/js/bootstrap.min.js
file4 = fileadmin/design/js/lightbox.min.js
file5 = fileadmin/design/js/lightbox.js
}
}
page.10.renderObj {
# Text is used for the text content element.
text = COA
text {
10 = TEXT
# The field tt_content.header normally holds the headline.
10.stdWrap.field = header
10.stdWrap.wrap = <h1>|</h1>
10 = TEXT
# The field tt_content.bodytext holds the content text.
10.stdWrap.field = bodytext
10.stdWrap.wrap = <p>|</p>
}
}
page.20 = TEMPLATE
page.20.template = FILE
page.20.template.file = fileadmin/design/index.html
page.headerData.20 = TEXT
page.headerData.20.value (
)
lib.navbar = COA
lib.navbar {
wrap = <nav class="navbar navbar-default"> <div class="container-fluid"> | </div> </nav>
10 = COA
10 {
wrap = <div class="navbar-header"> | </div>
10 = COA
10 {
// hamburger icon:
wrap = <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">|</button>
10 = TEXT
10.value = <span class="button-label">Menu</span><div class="button-bars"><span class="icon-bar"></span><span class="icon-bar"></span><span class="icon-bar"></span></div>
20 = TEXT
21 < .20
22 < .20
}
}
20 = HMENU
20 {
wrap = <div id="navbar" class="navbar-collapse collapse"> <ul class="nav navbar-nav"> | </ul> </div>
1 = TMENU
1 {
expAll = 1
NO = 1
NO {
ATagTitle.field = title
wrapItemAndSub = <li>|</li>
}
CUR < .NO
CUR {
wrapItemAndSub = <li class="active">|</li>
}
ACT < .CUR
IFSUB = 1
IFSUB {
ATagTitle.field = title
ATagParams = class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false"
linkWrap = |<b class="caret"></b>
ATagBeforeWrap = 1
wrapItemAndSub = <li class="dropdown">|</li>
}
ACTIFSUB < .IFSUB
ACTIFSUB {
wrapItemAndSub = <li class="dropdown active">|</li>
}
CURIFSUB < .ACTIFSUB
}
2 < .1
2 {
// Adjust several classes for sublevels
wrap = <ul class="dropdown-menu multi-level">|</ul>
IFSUB.wrapItemAndSub = <li class="dropdown-submenu">|</li>
ACTIFSUB.wrapItemAndSub = <li class="dropdown-submenu active">|</li>
// Remove caret element (correct arrow is set with ::after pseudo element)
IFSUB.linkWrap >
ACTIFSUB.linkWrap >
CURIFSUB < .ACTIFSUB
SPC = 1
SPC {
wrapItemAndSub.cObject = COA
wrapItemAndSub.cObject {
// no divider, if first menu item on this level:
10 = TEXT
10.value = <li class="dropdown-header">|</li>
10.if.value.data = register:count_MENUOBJ
10.if.equals = 1
// otherwise:
20 = TEXT
20.value = <li class="divider"></li><li class="dropdown-header">|</li>
20.if.value.data = register:count_MENUOBJ
20.if.equals = 1
20.if.negate = 1
}
}
}
3 < .2
4 < .3
}
}
page.20.marks{
CONTENT < styles.content.get
CONTENT.renderObj.stdWrap.dataWrap=<div class="col-md-12">|</div>
TOPIMAGE < styles.content.get
TOPIMAGE.select.where = colPos=1
contentright < styles.content.getRight
contentright.select.where = colPos=2
#contenborder < styles.content.get
#contentorder.select.where = colPos=3
#TOPIMAGE < styles.content.getBorder
#TOPIMAGE.select.where = colPos=4
MENU = HMENU
MENU.entryLevel = 0
#NAVIMAIN.excludeUidList =
MENU < lib.navbar
}
答案 0 :(得分:1)
我建议您先看看内置在数据处理器中的TYPO3。它们是由核心提供的(当然,您也可以使用自定义的)。这样,您可以轻松地查询记录并将其传递到流体模板,在此您可以处理数据并将其输出为HTML。也有一个菜单数据处理器。您可以嵌套数据处理器,以便获得例如当前级别和子级别的页面。
它比纯TS方式更灵活,对于每个不太熟悉TS的人来说,它将简化很多事情。
https://docs.typo3.org/typo3cms/TyposcriptReference/ContentObjects/Fluidtemplate/Index.html
答案 1 :(得分:0)
对我来说有效的解决方案是:
lib.unterseiten = CONTENT
lib.unterseiten {
table = pages
select {
pidInList.field = 10
orderBy = sorting
}
renderObj = COA
renderObj.wrap = <div class='col-md-3'>|</div>
renderObj {
10 = TEXT
10.field = title
10.wrap = <h2>|</h2>
20 = CONTENT
20 {
table = tt_content
select {
pidInList.field = uid
orderBy = sorting
}
renderObj = COA
renderObj {
#Bild auslesen
30 = FILES
30 {
maxItems = 1
references {
table = tt_content
uid.data = field:uid
fieldName = image
}
renderObj = IMAGE
renderObj.file.import.data = file:current:uid
renderObj.file.treatIdAsReference = 1
renderObj.wrap = <div class="thumbnail">|</div>
renderObj.stdWrap.maxItems = 1
}
40 = TEXT
40.field = uid
40.wrap = <a href="index.php?id=|">Mehr infos</a>
}
}
}
}
page.20.marks.kumulierterInhalt < lib.unterseiten