Harsha M V
Harsha M V

Reputation: 54949

CakePHP HTML Helper

I am trying to replicate the following code using HTML Helper in CakePHP 2.1. Not sure how to include the Span tag into the tag.

<div class="backTo">
    <a href="#" title="">
      <img src="images/icons/topnav/mainWebsite.png" alt="" />
      <span>Main website</span>
    </a>
</div>

What i have tried

<?php echo $this->Html->image("icons/topnav/mainWebsite.png", array("alt" => "Back", 'url' => array('controller' => 'pages', 'action' => 'display', 'home')); ?>

Upvotes: 0

Views: 702

Answers (1)

deceze
deceze

Reputation: 522081

echo $this->Html->link(
    $this->Html->image('...', array(...)) . '<span>Main website</span>',
    array('controller' => ...),
    array('escape' => false)
);

Upvotes: 2

Related Questions