Author Topic: html "newline" TAG <br> works not correc  (Read 675 times)

0 Members and 1 Guest are viewing this topic.

chris

  • Guest
html "newline" TAG <br> works not correc
on: Thu, 12. December 2002 - 00:26:55
Hello

The text for den Website should come from a mysql database.
In some textfields there I need a newline and the TAG  <br>   changed to   &lt;br&gt;.


Old version and ok
This is my old methode without template. It works fine. When I write a <br> in the database then on watching the website a newline is happen.

//Auslesen der Datem aus Datenbank
res=mysql_db_query("multilingual","select * from lang_".$lang."_art where id="$id"" );
for ($i=0; $i<$num;$i++)
{
  $did=mysql_result($res,$i,"id");
  $title=mysql_result($res,$i,"title");
  $inhalt=mysql_result($res,$i,"inhalt");
  $lf= $i+1;
//Öffnen der Contenttabelle und Schliessen
//echo "<tr><td>$title</td></tr><tr><td>$inhalt</td></tr>";
echo "<tr><td >$inhalt</td></tr>";
}


New Version and not ok (with template)

php file

$restext=mysql_db_query("multilingual","select * from lang_".$lang."_art where id="$id"" );

$tmpl->setdbloop('text', $restext, mysql);

$tmpl->pparse();

html file (template file)
<tmpl_loop name='text'>
<tr><td >d<tmpl_var name='inhalt'></td></tr>
</tmpl_loop>

releasedj

  • Guest
html "newline" TAG <br> works not correc
Reply #1 on: Thu, 12. December 2002 - 10:18:19
Hi,

By default, vlibTemplate escapes variables using htmlspecialchars() (see the vlibIni.php file).
This default option simplifies the task of escaping a variable. If you need to turn off escaping for a particular variable, the just add "escape='none'" to the tag, in your example it would look like:

Code: [Select]

tmpl_loop name='text'

trtd dtmpl_var name='inhalt' escape='none'/td/tr

/tmpl_loop



Take a look at the vlibTemplate documentation in the 'Options' section.
The option called 'DEFAULT_ESCAPE' will provide you more detailed information about this feature.

It's probably worth taking 5 or 10 minutes to browse the docs anyway, just to get a handle on exactly what vlibTemplate can do.

Regards,

Kelvin