echo $this->Html->link(
'<span class="glyphicon glyphicon-remove"></span> Cancel',
array(
'action'=>'index',
'page:'.$this->request->data['Transaction']['page']
),
array(
'class'=>'btn btn-default',
'escape'=>false
),
'Do you want to cancel ?'
);
Why we use escape => false in cakephp
3.6k views Asked by sarvesh t At
3
There are 3 answers
0
On
HTML special characters in $title
will be converted to HTML entities. To disable this conversion, we set the escape option to false in the $options
array:
$this->Html->link($title, $url, $options);
Read: Manual
0
On
All HTML characters will be escaped on Views by default, just as if you used htmlentities()
on it, so for this reason, all elements created by CakePHP Helpers ($this->Html->link()
in this case) need the param 'escape' => false
to avoid that conversion, be it trying to use nested tags or nested HTML in the label or so.
Because your label is HTML rather than plain text.
You don't want to insert a literal
<span class="glyphicon glyphicon-remove"></span>
text, you want an HTML tag to display an icon.