 |
Smarty
The discussions here are for Smarty, a template engine for the PHP programming language. Dedicated server web hosting provided by Guru-host.eu. |
| View previous topic :: View next topic |
| Author |
Message |
sofl Smarty n00b

Joined: 05 Oct 2011 Posts: 2
|
Posted: Wed Oct 05, 2011 9:55 am Post subject: [3.1.2] Probleme mit Maskierungen |
|
|
Hallo Liebe Kommunität.
Nachdem ich einige kleinere Maskierungsprobleme mit Smarty 3.1RC hatte, aktualisierte ich auf den aktuellen Release-Kanidat 3.1.2 .
Ich verwende das "neue" Feature der automatischen Maskierung von Variablen.
| Code: | | $smarty->escape_html = true; |
Nach dem Upgrade auf 3.1.2, passiert nun folgendes.
Bsp.
PHP
| Code: | | $smarty->assign('foo','blabla'.PHP_EOL.'blabla'); |
Template
Ausgabe
gewünschte Ausgabe
Ich habe verschiedene work arounds versucht aber bisher bin ich immer gescheitert
Beispielsweise wollte ich die Variable erst mit einem nofilter flag capturen und dann ausgeben lassen, was aber ebenfalls misslang.
Kombinationen wie diese scheinen ebenfalls nicht zu funktionieren
| Code: |
{$foo|nl2br nofilter}
{$foo nofilter |nl2br}
|
Des weiteren habe ich das Problem, dass wenn ich eine Variable mit dem urlencode oder escape:"url" modifier belegen will, diese vorher ebenfalls maskiert wird.
Beispiel:
Preis "Ausgewählte Orte im Land der Ideen 2011"
Resultat mit escape:"url"
| Code: | | Preis+%26quot%3BAusgew%C3%A4hlte+Orte+im+Land+der+Ideen+2011%26quot%3B |
Gewünschtes Resultat
| Code: | | Preis%20%22Ausgew%C3%A4hlte%20Orte%20im%20Land%20der%20Ideen%202011%22 |
Ich habe versucht die automatische Maskierung manuell anzuwenden
| Code: |
$smarty->escape_html = false;
require_once SMARTY_DIR.'plugins/shared.escape_special_chars.php';
$smarty->registerFilter('variable','smarty_function_escape_special_chars');
|
Allerdings entsteht hier kein Unterschied.
All diese Probleme hatte ich mit 3.1RC noch nicht und hier im Forum habe ich auch keine Lösung gefunden. Kann mir eventuell jemand einen Tipp oder vllt sogar eine Lösung anbieten?
Danke
LG sofl |
|
| Back to top |
|
jacz Smarty Pro

Joined: 13 Nov 2010 Posts: 249
|
Posted: Wed Oct 05, 2011 2:53 pm Post subject: |
|
|
Test
| Code: |
$smarty->escape_html = true;
$smarty->assign('foo','blabla'.PHP_EOL.'blabla');
$smarty->display('string:{$foo=$foo|nl2br}{$foo nofilter}');
$smarty->assign('foo','Preis "Ausgewählte Orte im Land der Ideen 2011"');
$smarty->display('string:{$foo|escape:"url"}');
|
Ausgabe
| Code: |
blabla<br/>
blabla
Preis%20%22Ausgew%C3%A4hlte%20Orte%20im%20Land%20der%20Ideen%202011%22
|
|
|
| Back to top |
|
sofl Smarty n00b

Joined: 05 Oct 2011 Posts: 2
|
Posted: Wed Oct 05, 2011 3:03 pm Post subject: |
|
|
| Danke, werde ich gleich mal ausprobieren. |
|
| Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|