Header menu


Tuesday, 8 October 2013

Add span tag( or any html tag) to link in cakephp

To add <span> tag to cakephp link add span to label

"<span>Label name</span>"

and add

"array('escape' => false)"

to link as shown in below example.

<?php echo $this->Html->link(
    '<span>My Label</span>',
    array('action' => 'add'),
    array('escape' => false)
// This line will parse rather then output HTML
); ?>
One thing to note here 'escape' => false' must be added to 3rd parameter of link.
You can see the structure of cakephp link for more information at