Peh
Peh

Reputation: 78

TYPO3 6.2: Image-Slider with Hyperlink from Page Ressources

I did a well working Imageslider from the page ressources. Now I'm trying to hyperlink those Images with a Link also provided in the ressource. This is what I have so far:

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
}

Layout:

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

This Results in the expected HTML Output

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

But I want the following Output

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

How do I get those Links around my Images?

Thanks in advance

UPDATE

Solution:

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
            }
        }
    }
}

Upvotes: 3

Views: 2664

Answers (3)

Jimit Shah
Jimit Shah

Reputation: 713

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 = |
  }
}

Reference link: http://www.t3hut.com/blog/post/news/detail/News/random-image-from-page-resources-files-in-typo3-62.html

This ts works for me !

Upvotes: 1

Urs
Urs

Reputation: 5122

Can you try this?

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
}

Upvotes: 1

Merec
Merec

Reputation: 2761

You shoul use FILES to handle this. Use something like (not tested!)

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>
            }
        }
    }
}

Upvotes: 6

Related Questions