1

how can i combine the link and image helper in lithium? I want something like:

<a href="http://...">
    <img src="mypic.png" />
    And a title
</a>

I tried different options but nothing seems to work, do i have to write my own helper?

<?php
    $image = $this->html->image('mypic.png');
    echo $this->html->link('And a title', '', array('html' => $image));
?>
Mewel
  • 1,279
  • 15
  • 21

1 Answers1

4

You should escape html code

 $image = $this->html->image('mypic.png');
 $this->html->link($image, $url, array('escape' => false))

http://li3.me/docs/lithium/template/helper/Html::link()

botero
  • 598
  • 2
  • 11
  • 23
Mehdi Lahmam B.
  • 2,240
  • 16
  • 22
  • echo $this->html->link($image .'test', '', array('escape' => false)) to add a text. thx – Mewel Jan 16 '12 at 00:31