TYPO3 6.2:带有来自页面资源的超链接的图像滑块

时间:2014-09-19 07:27:39

标签: typo3 typoscript typo3-6.2.x

我从页面资源中做了一个很好的Imageslider。现在,我尝试使用资源中提供的链接来超链接这些图像。这就是我到目前为止所做的:

TS:

lib.headerimage = COA_INT
lib.headerimage {
    1 = COA
    1 {
        stdWrap.required = 1
        stdWrap.outerWrap.cObject = TEXT
        stdWrap.outerWrap.cObject.value = <li><img src=" | " /></li>

        2 = IMG_RESOURCE
        2 {
            file {
                import.data = levelmedia:-1, slide
                import.listNum = 0
                treatIdAsReference = 1
            }
        }   
    }
    2 < .1
    2.2.file.import.listNum = 1
    3 < .1
    3.2.file.import.listNum = 2
}

布局:

<div class="headerimage">
    <ul>
        <f:render section="headerimage" />
    </ul>
</div>

此结果是预期的HTML输出

<ul>
    <li>
        <img />
    </li>
</ul>

但我想要以下输出

<ul>
    <li>
        <a href="link_from_page_ressource">
            <img />
        </a>
    </li>
</ul>

如何在图片周围获取这些链接?

提前致谢

更新

解决方案:

lib.headerimage = COA
lib.headerimage {
    1 = FILES
    1 {
        references {
            data = levelmedia:-1, slide
        }
        renderObj = COA
        renderObj {
            wrap = <li>|</li>

            1 = IMAGE
            1 {
                file.import.data = file:current:publicUrl
                altText.data = file:current:title
                stdWrap.typolink.parameter.data = file:current:link
            }
        }
    }
}

3 个答案:

答案 0 :(得分:6)

您应该使用FILES来处理此问题。使用类似的东西(未经测试!)

lib.headerimage = COA
lib.headerimage {
    wrap = <ul>|</ul>

    10 = FILES
    10 {
        references {
            data = levelmedia:-1, slide
        }

        renderObj = COA
        renderObj {
            10 = IMAGE
            10 {
                file.import.data = file:current:publicUrl
                altText.data = file:current:title
                stdWrap.typolink.parameter.data = file:current:link
                wrap = <li>|</li>
            }
        }
    }
}

答案 1 :(得分:1)

你能试试吗?

lib.headerimage = COA
lib.headerimage {
   wrap = <ul>|</ul>

        1 = IMAGE
        1 {
            file {
                import.data = levelmedia:-1, slide
                import.listNum = 0
                treatIdAsReference = 1
            }
            stdWrap.typolink.parameter.data = file:current:link
            stdWrap.outerWrap = <ul>|</ul>
        }   

    2 < .1
    2.file.import.listNum = 1
    3 < .1
    3.file.import.listNum = 2
}

答案 2 :(得分:1)

lib.randomImage = COA_INT
lib.randomImage.10 = FILES
lib.randomImage.10.sorting = rand()
lib.randomImage.10 {
  references {
    table = pages
    data = levelmedia:-1, slide
    treatIdAsReference = 1
  }
  maxItems= 1
  renderObj = COA
  renderObj {
    10 = IMAGE
    10 {
      file {
        import {
          data = file:current:publicUrl
        }
      }
    }
  }
  stdWrap {
    wrap = |
  }
}

参考链接:http://www.t3hut.com/blog/post/news/detail/News/random-image-from-page-resources-files-in-typo3-62.html

这个对我有用!