-2

I am using CakePHP 2.8.9 and my app receives Flash messages.
How to format the message into sentences. For example: MSG1 new line MSG2 and so on.

$message = 'Bla bla bla .new line bla bla bla';
$this->Flash->set($message, array(
                'element' => 'flash_error',
            ));

I already tried with br nbsp /n.

$message = "Bla bla bla < br/> line bla bla bla";
$message = "Bla bla bla /n line bla bla bla";
$message = "Bla bla bla &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; line bla bla bla";

What should I use to create a new line ?

  • 1
    since is html `
    ` should work
    – arilia Feb 17 '17 at 13:53
  • Check the manual how to edit strings. What you want is called a **linebreak**. Then render the html as `Bla bla bla bla bla bla` – VC.One Feb 17 '17 at 14:03
  • I already tried with br nbsp /n – user3616375 Feb 17 '17 at 14:17
  • 1
    @user3616375 it might be worth showing the code you've tried in your question. – drmonkeyninja Feb 17 '17 at 14:22
  • `< br/>` isn't valid HTML, whitespace after the opening bracket is not allowed. Also escaped character sequences are indicated using a backslash, not a forward slash (not that they would work here anyways), and ` ` is a non-breaking space, not a linebreak. – ndm Feb 17 '17 at 21:55

1 Answers1

0

Seems that problem is not related to CakePhp flash render, it's related with a Security Component callback error method where I want to flash message. Ended it up using something like : __('admin', 'Security error occured.%s Please, try again.','&emsp;&emsp;&emsp;');