|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
lord_icon Smarty n00b
Joined: 31 Jan 2017 Posts: 3
|
Posted: Tue Jan 31, 2017 11:00 am Post subject: Umlaute in Variablenamen |
|
|
Hi,
ich nutze JTL wo smarty für die Template zum Einsatz kommt.
Ein Template will ich nun erweitern und bin auf ein Problem bzgl. Sonderzeichen respektive Umlaute gestoßen.
Ausgeben mit einer schleife geht
Code: |
{foreach from=$Artikel->FunktionsAttribute key=key item=item}
"{$key}" => "{$item}"
{/foreach}
"größenschema_s" => "27.7"
"farbschema_s" => "Blau"
"farbe_s" => "Blau"
"produktname_s" => "CLAS20-BLMPU"
"schuhgröße_s" => "8"
|
Möchte ich es direkt abfragen, bekomme ich entweder eine weiße Seite oder halt garkein Output.
Folgendes hab ich schon versucht:
Code: |
{$Artikel->FunktionsAttribute.größenschema_s}
{$Artikel->FunktionsAttribute.'größenschema_s'}
{$Artikel->FunktionsAttribute['größenschema_s']}
{$Artikel->FunktionsAttribute["größenschema_s"]}
{$Artikel->FunktionsAttribute.["größenschema_s"]}
{assign var=foo value=$Artikel->FunktionsAttribute["größenschema_s"]}
{$foo}
|
Habe ich noch andere Möglichkeiten ?
Danke |
|
Back to top |
|
AnrDaemon Administrator
Joined: 03 Dec 2012 Posts: 1785
|
Posted: Tue Jan 31, 2017 1:03 pm Post subject: |
|
|
Using questionable characters as list indices is always a risk. |
|
Back to top |
|
lord_icon Smarty n00b
Joined: 31 Jan 2017 Posts: 3
|
Posted: Tue Jan 31, 2017 1:13 pm Post subject: |
|
|
I get so predefined.
Other idea.
I go through the values and rebuild them
Code: |
{foreach from=$Artikel->FunktionsAttribute key=key item=item}
{assign var="key" value="{$key|replace:" ":"_"|escape:"url"|replace:"%F6":"oe"|replace:"%20":""|replace:"%DF":"ss"|replace:"%2F":"_"}"}
{assign var=$key value={$item}}
{$key}<br>
{/foreach}
|
{$key}<br>:
Code: | groessenschema_s
schuhgroesse_s
etc ...
|
Now I want to put these together again.
Code: |
{assign var=array value=['Größenscheme:' => 'groessenschema_s',
'Schuhgröße:' => 'schuhgroesse_s'
]
}
{foreach from=$array key=key item=item}
{${$item}} : {key} <= failed
${$item} : {key} <= failed
{/foreach}
|
How do I put a variable from a variable name together?
Thanks !!! |
|
Back to top |
|
AnrDaemon Administrator
Joined: 03 Dec 2012 Posts: 1785
|
Posted: Tue Jan 31, 2017 1:18 pm Post subject: |
|
|
You must use same encoding for your templates and for your PHP source files. Once these match, your issue will disappear. |
|
Back to top |
|
lord_icon Smarty n00b
Joined: 31 Jan 2017 Posts: 3
|
Posted: Tue Jan 31, 2017 1:22 pm Post subject: |
|
|
How can I query this?
Is indeed a foreign code. |
|
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
|