如何配置带图像和副标题的特殊按钮

时间:2014-06-30 19:36:23

标签: typo3 typoscript

我想生成以下带有typoscript的html按钮,但在尝试了几个小时后仍未成功。图像是页面图像,标题是页面标题,副标题是页面字幕。愿有人可以帮忙吗?

<div class="left_links">
  <a href="/verhalen-van-klanten.html"><img src="/images/layout/klanten.png"></a>
  <table class="left_text active">
    <tr><td><a href="/verhalen-van-klanten.html"><font style="font-size: 16px;">Verhalen van klanten</font></a></td></tr>
    <tr><td><a href="/verhalen-van-klanten.html">Wat vind jij?</a></td></tr>
  </table>
</div>

我使用了下面的typoscript:

  tipmenu = HMENU
  tipmenu.special = directory
  tipmenu.special.value = 8
  tipmenu {
    1 = TMENU
    1 {
      expAll = 1
      wrap = <div class="left_links">|</div>

      NO {
        linkWrap = |<table class="left_text">
        after {
          wrap = <tr><td>|</td></tr></table>
          field = subtitle
        }      
      }
    }
  }

生成以下html:

<div class="left_links">
  <a href="tips/verhalen-van-klanten/" >Verhalen van klanten</a>
  <table class="left_text">
    <tr><td>Wat vind jij?</td></tr>
  </table>
</div> 

所以它仍然缺少图像,标题位置错误,字幕周围的链接丢失了?

1 个答案:

答案 0 :(得分:0)

我不确定您对多个项目的预期输出是什么,但以下代码应该做您想要的。

但请重新考虑您的菜单:<font><table>?这就是15年前你做菜单的方式。今天我们有HTML5和CSS - 没有必要使用那些丑陋的标签进行格式化。

tipmenu = HMENU
tipmenu {
    special = directory
    special.value = 8
    1 = TMENU
    1 {
        expAll = 1
        wrap = <div class="left_links">|</div>
        NO = 1
        NO {
            # uncomment if needed
            # allWrap = <div class="left_links_one">|</div>
            beforeImgLink = 1
            beforeImg = GIFBUILDER
            beforeImg {
                XY = 80,80s
                10 = IMAGE
                10.file {
                    # load the first image in the media field
                    import = uploads/media/
                    import.field = media
                    import.listNum = 0
                    height = 80
                    width = 80m
                }
            }
            linkWrap = <table class="left_text"><tr><td><font style="font-size: 16px;">|</font></td></tr>
            after.cObject = COA
            after.cObject {
                30 = TEXT
                30.field = subtitle
                30.typolink.parameter.field = uid
                30.wrap = <tr><td>|</td></tr>
                wrap = |</table>
            }
        }
    }
}