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.

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

http://book.cakephp.org/2.0/en/core-libraries/helpers/html.html

No comments:

Post a Comment