How to write two span tags or two elements inside an cake php link in cakephp ?
For example
<?php
$title = '$this->Html->tag('span', 'Test Title', array('style' => 'color:blue'))';
$status = '$this->Html->tag('span', ' (New) ', array('style' => 'color:black'))';
echo $this->Html->link( $title.$status, 'people/video'.$person['video']['id'], 'target' => '_blank'));
?>
So that I can output
<a href="people/video/765" target ="_blank" ><span style="color: blue">Test Title</span><span style="color: #000000;"> (New) </span> </a>
$this->Html->link()automatically escapes special characters which causes HTML to be rendered as special characters. You can setescapeoption of$this->Html->link()tofalseto accomplish want, see the manual for further options.Your updated code would look like the following. I removed the inverted commas around
$titleand$statusand wrapped'target' => '_blank'in an array, you can’t use key => value pairs in the way you use them in your original code. Probably it was part of an array structure before, as there was an extraneous parenthesis at the end of that line.