Kenobi
Kenobi

Reputation: 15

cakephp, how to link with two span

How to add two span tags to a link?

<?php echo $this->Html->tag('span’, 
    $this->Html->link($v['name']['lastname'], 
    $v['link’]
    ); 
?>

//Output
<a class=« test" href="./#">
   <span>name</span>
   <span>lastname</span>
</a>

I'm not sure to be a good start, thank you for the help

Upvotes: 1

Views: 122

Answers (2)

Oldskool
Oldskool

Reputation: 34857

Simply concatenate two span tags with the HtmlHelper in the first argument of the link() method.

echo $this->Html->link(
    $this->Html->tag('span', $v['name']) .
    $this->Html->tag('span', $v['lastname']),
    $v['link'],
    array('escape' => false)
);

Upvotes: 2

Kai
Kai

Reputation: 3823

I believe this should do it:

<?php echo $this->Html->link('<span>name</span><span>lastname</span>', '#', array('escape' => false)); ?>

Upvotes: 2

Related Questions