nickyfsh
nickyfsh

Reputation: 175

CakePHP link helper

I am currently dabbling a little bit into CakePHP and I was wondering how I can achieve the following link using the HTML->link helper.

Original HTML Link:

     <a href="edit" class="btn btn-primary btn-icon glyphicons circle_plus"><i></i> Edit Client</a>

CakePHP:

    echo $this->Html->link('Edit Client', ''.$edit_link.'', array('class' => 'btn btn-primary btn-icon glyphicons circle_plus'));

Which method can I adapt in order replicate the same exact link structure as in the original HTML link?

Some advise would be appreciated

Upvotes: 1

Views: 1743

Answers (1)

summea
summea

Reputation: 7583

It looks like your original idea would work; but if it helps, here is a slight modification:

echo $this->Html->link(
    '<i></i> Edit Client',
    $edit_link,
    array(
        'class' => 'btn btn-primary btn-icon glyphicons circle_plus',
        'escape' => false
    )
);

In order to keep HTML tags included in the link text, try using the escape option, like this:

'escape' => false

More reference information about the escape option (and other options,) can be found in the CakePHP book.

Upvotes: 3

Related Questions