CakePHP HTML link

Harsha M V picture Harsha M V · Dec 21, 2011 · Viewed 9.3k times · Source

I am trying to use CakePHP HTML Linker for the following code

<li class="iAdd"><a href="add"><span>Add Cuisine</span></a></li>

Since the span tag needs to be inside the a tag. am not able to get the output as need. Any suggestions on how to get it done ?

Answer

Oldskool picture Oldskool · Dec 21, 2011

Disable the escape option in your link code, like so:

<li class="iAdd">
<?php echo $this->Html->link(
    '<span>Add Cuisine</span>',
    array('action' => 'add'),
    array('escape' => false) // This line will parse rather then output HTML
); ?>
</li>