Author Topic: HTML and output  (Read 2830 times)

0 Members and 1 Guest are viewing this topic.

area32

  • Guest
HTML and output
on: Tue, 12. April 2005 - 12:55:11
Example:
Code: [Select]
?
ex = This is a text.br /This is line 2.;
tmpl-setVarexample, ex;
?
Output:
This is a text.<br />This is line 2.

But I want a correct output as

This is a text.
This is line 2.

How can I get that?

Offline StefanD

  • Newbie
  • *
  • Posts: 4
HTML and output
Reply #1 on: Tue, 12. April 2005 - 15:15:00
You have to set the parameter escape to none in the template for this variable, if you want them to be displayed.

for example:
Code: [Select]
{tmpl_var name=post escape=none}
greetings,
Stefan

P.S: its not a bug its a feature.
Last Edit: Tue, 12. April 2005 - 15:17:55 by StefanD

area32

  • Guest
HTML and output
Reply #2 on: Wed, 13. April 2005 - 07:38:27
Thanks
Last Edit: Thu, 20. July 2006 - 17:44:19 by ClausVB

Offline ClausVB

  • Administrator
  • Hero Member
  • *****
  • Posts: 566
    • Homepage: clausvb.de
HTML and output
Reply #3 on: Wed, 13. April 2005 - 16:42:16
You can enable parsing in your "vlibIni.php".

See
/forum/index.php/topic,71
and
vlibTemplate Options

Quote
DEFAULT_ESCAPE - when using the template in an html-based application you should escape most of the string passed into the template using htmlspecialchars(). This option will allow you to specify a default escape type for all of your <tmpl_var>s. To overwrite this option, you can either use a different setting when instantiating vlibTemplate using the options array, or on per tag basis i.e. <tmpl_var name="varname" escape="url">. The following values are all possible escape values. NB: more escape attributes may be added in the future.

HTML - html escapes a string.
URL - url escapes a string.
RAWURL - rawurl escapes a string.
SQ - escapes single quotes in a string.
DQ - escapes double quotes in a string.
NONE - turns off escaping.
1 - alias for html escaping.
0 - alias for NONE. (1 and 0 are for compatibility with Perls HTML::Template).
HEX - hex encodes a string.
HEXENTITY - encodes a string to hex entities.
Regards,
Claus
Last Edit: Wed, 07. March 2007 - 10:33:13 by ClausVB