Ankan-Zerob
Ankan-Zerob

Reputation: 3468

Unable to use HTML Tags inside HtmlHelper::link()

I have the following link to generate the following link with helpers:

<a href="/rooms" class="ln-room">
    <span class="room-icon cls-icon"></span>
    <span class="lable">rooms</span>
</a>

I cannot supply the span tags inside $combine, as HtmlHelper::link() calls htmlspecialchars_decode(), thus converting all html to characters.

echo $this->Html->link($combine, array(
                                    'controller' => 'rooms',
                                    'action' => 'index'
                                 ),
                                 array('class' => 'ln-room')
                                 );

If the only way is to create a custom helper, how can it be done?

Upvotes: 0

Views: 98

Answers (1)

Dave
Dave

Reputation: 29121

echo $this->Html->link($combine, array(
        'controller' => 'rooms',
        'action' => 'index'
    ),
    array(
        'class' => 'ln-room',
        'escape' => false  // <--- THIS
    )
);

Upvotes: 1

Related Questions