1
我有以下typoscript代碼的片段,它顯示具有定義類名稱的圖像。缺乏的是圖像的寬度,高度,對齊等屬性;它們已經在後端編輯器中設置了。Typo3:如何設置像寬度,高度和ALT等圖像屬性?
30 = FILES
30 {
references {
table = tt_content
fieldName = image
}
renderObj = IMAGE
renderObj {
file.import.data = file:current:publicUrl
params = class="img-responsive img-centered"
}
}
...
...
}
呈現的HTML是一樣的東西:<img class="img-responsive img-centered" width="600" height="880" border="0" alt="" src="preview.png">
我怎麼也顯示自定義的寬/高/對齊從後端設置屬性?
==增加了更多的細節==
這是我這部分的代碼的整個區塊:
temp.portfolio = CONTENT
temp.portfolio {
table = tt_content
select {
begin = 1
orderBy = sorting
where = (colPos = 2)
}
renderObj = COA
renderObj {
10 = TEXT
10 {
required = 1
wrap = <a class="portfolio-link" data-toggle="modal" href="#portfolioModal"><div class="portfolio-hover"><div class="portfolio-hover-content"><i class=" | "></i></div></div>
stdWrap.field = custom_icon
}
15 = FILES
15 {
references {
table = tt_content
fieldName = image
}
renderObj = IMAGE
renderObj {
file.import.data = file:current:publicUrl
params = class="img-responsive"
}
}
20 = TEXT
20 {
required = 1
wrap = </a><div class="portfolio-caption"><h4> | </h4>
stdWrap.field = header
#parseFunc =< lib.parseFunc_RTE
}
30 = TEXT
30 {
required = 1
wrap = <p class="text-muted"> | </p>
stdWrap.field = subheader
#parseFunc =< lib.parseFunc_RTE
}
40 = TEXT
40 {
wrap = </div>
}
50 = CONTENT
50 {
table = tt_content
select {
uidInList {
field = header_link
stdWrap.replacement.10 {
search = /^.+#/
replace =
useRegExp = 1
}
}
max = 1
where = (pid = 11)
pidInList {
field = header_link
stdWrap.replacement.10 {
search = /#.+$/
replace =
useRegExp = 1
}
}
}
renderObj = COA
renderObj {
10 = TEXT
10.value {
required = 1
wrap = <h2> | </h2>
field = header
}
20 = TEXT
20.value {
required = 1
wrap = <p class="item-intro text-muted"> | </p>
field = subheader
}
30 = FILES
30 {
references {
table = tt_content
fieldName = image
}
renderObj = IMAGE
renderObj {
file {
import.data = file:current:publicUrl
width.field = imagewidth
height.field = imageheight
}
params = class="img-responsive img-centered"
altText.data = file:current:alternative
}
}
40 = TEXT
40.value {
required = 1
wrap = |
field = bodytext
parseFunc =< lib.parseFunc_RTE
}
stdWrap.wrap = <span class="float-window" style="display:none"> | </span>
}
}
stdWrap.wrap = <div class="col-md-4 col-sm-6 portfolio-item"> | </div>
}
}
感謝Lasse的回覆。但是,恐怕不會影響圖像的寬度和高度屬性。儘管如此,alt-text字段顯示的是後端的值。我還能檢查什麼? '30 = FILES 30 { \t引用{ \t \t表= tt_content \t \t的fieldName =圖像 \t} \t renderObj = IMAGE \t renderObj { \t \t文件{ \t \t \t import.data = file:current:publicUrl \t \t \t width.field = imagewidth \t \t \t height.field = imageheight \t \t} \t \t PARAMS =類= 「IMG響應IMG爲中心」 \t \t altText.data =文件:電流:替代 \t} }' 另外如何顯示左/右/ absmiddle選項的「對齊」字段? – Ren
您能否修改您的問題並在'30 = FILES'之前包含一些代碼。 '30 = FILES'只獲取file_reference對象而不是tt_content對象。這就是爲什麼我用'lib.myContent
Lasse
在問題中添加了詳細的代碼。 – Ren