Author Topic: use nl2br in combination with a tmpl_var  (Read 635 times)

0 Members and 1 Guest are viewing this topic.

Frank

  • Guest
use nl2br in combination with a tmpl_var
on: Mon, 09. December 2002 - 17:46:45
Hello,
i´ve got a MySQL-Text-field. I normaly use nl2br-function to format the text
I can' t tfigure out how to use it in combination with vlib template ?

I hope for a suggestion.

Best regards
Frank

releasedj

  • Guest
use nl2br in combination with a tmpl_var
Reply #1 on: Mon, 09. December 2002 - 19:35:58
If you want to use html in a var that is being passed to the template, then you must make sure that escaping is off for that particular tag, i.e.:

Code: [Select]

... in your php file

$htmltext = some textbr /on a new line;

$tmpl-setVar'myvar', $htmltext;



.. in your template

tmpl_var name=myvar escape=none



This will allow you to put html in your vars, otherwise, vlibTemplate encodes html in vars by default.

Have a look at the tmpl_var and options sections in the docs.

Regards,

Kelvin