[英]TYPO3 Section Menu Get Image and Typolink
I am trying to make a custom section menu of content elements that contains the first image in the element. 我正在尝试制作一个内容元素的自定义部分菜单,其中包含该元素中的第一张图片。 How do I get the image? 我如何获得图像?
Also what am I doing wrong with my typolink below? 另外,我的下面的错字链接怎么了?
This is what I have got so far: 到目前为止,这是我得到的:
tt_content.menu.20.101 < tt_content.menu.20.3
tt_content.menu.20.101 {
1.NO {
doNotLinkIt = 1
wrapItemAndSub = <div>|</div>
stdWrap.cObject = CONTENT
stdWrap.cObject {
table = tt_content
select {
pidInList.field = uid
}
renderObj = COA
renderObj {
10 = TEXT
10.field = header
10.typolink.parameter.field = uid
20 = TEXT
20.field = rowDescription
20.wrap = <h6>|</h6>
}
}
}
}
You need to access the associated files. 您需要访问关联的文件。
depending on your CE definitions the fieldname may vary ( files
, images
, media
) 根据您的CE定义,字段名称可能会有所不同( files
, images
, media
)
you may use something like: 您可以使用类似:
renderObj.30 = FILES
renderObj.30 {
stdWrap.wrap = <div class="pic">|</div>
references {
table = tt_content
#uid.data = uid
fieldName = image
}
renderObj = IMAGE
renderObj {
file {
import.data = file:current:uid
treatIdAsReference = 1
width = 150c
height = 150c
}
altText.data = file:current:alternative
titleText.data = file:current:title
#params = class="menu-img"
stdWrap.typolink.parameter.data = file:current:link
}
maxItems = 1
}
For your link (a second question would be appropiate as a different topic): 对于您的链接(第二个问题可能会适合作为另一个主题):
an integer value for .typolink.parameter
will link to that page. .typolink.parameter
的整数值将链接到该页面。 you provide an integer, but it's the uid of the content element. 您提供一个整数,但这是content元素的uid。
You need a link to a section: 您需要指向以下部分的链接:
typolink {
section.cObject = TEXT
section.cObject.field = uid
section.cObject.wrap = c|
}
The wrap depends on the rendering of anchors in your templates. 换行取决于模板中锚点的呈现。 I assume c
as it is the default. 我认为c
是默认设置。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.