1

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

2 Answers 2

2

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)
);
Sign up to request clarification or add additional context in comments.

Comments

2

I believe this should do it:

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.