0

i was wondering if there's any way to print " " inside a postLink element using CakePHP.

I want to get something like this:

<a href="#">&nbsp;</a>

And trying this:

'.$this->Form->postLink(nl2br("&nbsp;"), array('action'=> 'xxxx')).'

I get this instead:

<a href="#">&amp;nbsp;</a>

Which prints me   inside the link instead of printing a white space.

Alvaro
  • 40,778
  • 30
  • 164
  • 336

1 Answers1

4

Since postLink() is nothing else than a special wrapper for link() there should also be escape

$this->Form->postLink(nl2br('&nbsp;'), array('action' => 'xxxx'), array('escape' => false));

see https://github.com/cakephp/cakephp/blob/master/lib/Cake/View/Helper/FormHelper.php#L1582

mark
  • 21,691
  • 3
  • 49
  • 71