我希望在我的模板中有一个链接到第一个子页面(它是一个部分概述页面,因此总会有子页面可用)。该链接将始终具有相同的文本。
如何获取第一个子页面的ID?
pagelink = TEXT
pagelink {
value = Link to first child page
typolink {
parameter = [[id of first child page]]
}
}
答案 0 :(得分:1)
这是一个简单的解决方案:
pagelink = HMENU
pagelink {
# only display if there is a subpage
stdWrap.required = 1
# with value directory, the default special.value is the current page id
special = directory
# limit to 1 page
maxItems = 1
# link item
1 = TMENU
1 {
NO = 1
}
}
要覆盖页面标题,请使用:
pageLink = HMENU
pageLink {
# only display if there is a subpage
stdWrap.required = 1
# with value directory, the default special.value is the current page id
special = directory
# limit to 1 page
maxItems = 1
# link item
1 = TMENU
1 {
NO = 1
NO {
doNotLinkIt = 1
stdWrap.cObject = TEXT
stdWrap.cObject {
typolink.parameter.field = uid
# override text of menu item
value = Dummy Text
}
}
}
}
答案 1 :(得分:0)
有几种方法可以做到这一点(例如使用HMENU)但我会选择这个,因为如果你曾经决定让它更复杂(例如在页面文本链接的某处有页面标题,那么它很容易修改)根据媒体字段渲染缩略图。)
pagelink = CONTENT
pagelink {
table = pages
select {
pidInList = this
orderBy = sorting ASC
max = 1
}
renderObj = TEXT
renderObj {
value = Link to first child page
typolink {
parameter.field = uid
}
}
}
备注强>
value = Link to first child page
替换为field = title