2

我试图在我的菜单中的链接中添加背景图像。我的问题是我不知道如何将媒体上传字段中的文件路径获取到我的背景图像中。我菜单中的其他所有内容都有效。

lib.field_destinationmenu = HMENU
lib.field_destinationmenu {
    special = directory
    special.value = 565
    1 = TMENU
    1 {
        expAll = 1
        wrap = <div id="destinations">Destinationer</div><div id="destinations_places"><ul>|</ul></div>
        noBlur = 1
        NO {
            allWrap = <li class="first">|</li>|*|<li>|</li>|*|<li class="last">|</li>

            img = COA
            img.1 {
                file.import = uploads/media
                file.import.field = media
                file.import.listNum = 0
            }

            ATagParams =
            ATagParams.append = TEXT
            ATagParams.append.value = style="background-image:url( ***** )"

        }

        CUR < .NO
        CUR = 1
        CUR {
            wrap = <li class="first current">|</li>|*|<li class="current">|</li>|*|<li class="last current">|</li>
            ATagParams = class="current"
        }
    }

    #2 < .1
    #2.wrap = <ul class="submenu">|</ul>
    #3 < .2
    #4 < .2
}

我应该写什么而不是*

4

3 回答 3

1

像这样的东西,也许

ATagParams.append = IMG_RESOURCE
ATagParams.append {
  file.import = uploads/media
  file.import.field = media
  file.import.listNum = 0

  stdWrap.wrap = style="background-image:url(|)"
}

您不需要额外的 COA。您想要的只是 ATagParams 中的图像参考,所以把它放在那里。

于 2013-01-22T11:00:43.823 回答
0

这成为最终结果,它适用于 TYPO3 4.7 和 4.5

1 = TMENU
1.NO {
   ATagParams.cObject = COA
   ATagParams.cObject {
     20 = IMG_RESOURCE
     20.file.import = uploads/media/
     20.file.import.field = media
     20.file.import.listNum = 0
     20.stdWrap.noTrimWrap = | style="background-image: url('|');"|
     20.stdWrap.if.isTrue.field = media
   }
}
于 2013-02-01T12:23:59.127 回答
0

这是使用 FAL 的 TYPO3 6.2 的更新:

1 = TMENU
1.NO {
   ATagParams.cObject = COA
   ATagParams.cObject {
     20 = FILES
     20.references {
       fieldName = media
       listNum = 0
     }
     20.renderObj = IMG_RESOURCE
     20.renderObj {
       file.import.data = file:current:publicUrl
       file.treatIdAsReference = 1
       file.width = 125
     }
     20.stdWrap.noTrimWrap = | style="background-image: url('|');"|
     20.stdWrap.if.isTrue.field = media
   }
}
于 2016-01-26T13:32:03.300 回答