Smarty Forum Index Smarty
The discussions here are for Smarty, a template engine for the PHP programming language.
Dedicated server web hosting provided by Guru-host.eu.
[3.1.2] Probleme mit Maskierungen

 
Post new topic   Reply to topic    Smarty Forum Index -> Language: German
View previous topic :: View next topic  
Author Message
sofl
Smarty n00b


Joined: 05 Oct 2011
Posts: 2

PostPosted: Wed Oct 05, 2011 9:55 am    Post subject: [3.1.2] Probleme mit Maskierungen Reply with quote

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
Code:
{$foo|nl2br}


Ausgabe
Code:
blabla<br />blabla


gewünschte Ausgabe
Code:

blabla
blabla


Ich habe verschiedene work arounds versucht aber bisher bin ich immer gescheitert Confused

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
View user's profile Send private message
jacz
Smarty Pro


Joined: 13 Nov 2010
Posts: 249

PostPosted: Wed Oct 05, 2011 2:53 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
sofl
Smarty n00b


Joined: 05 Oct 2011
Posts: 2

PostPosted: Wed Oct 05, 2011 3:03 pm    Post subject: Reply with quote

Danke, werde ich gleich mal ausprobieren.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Smarty Forum Index -> Language: German All times are GMT
Page 1 of 1

 
Jump to:  
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
Protected by Anti-Spam ACP