|
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 |
mjimmy Smarty Rookie
Joined: 07 Dec 2011 Posts: 8
|
Posted: Wed Dec 07, 2011 2:06 pm Post subject: Probleme mit Variablen Angabe |
|
|
hallo, ich bin auf der Suche nach einer Lösung für dieses Problem -
ich möchte auf einen Index eines Arrays zugreifen
und dabei den Index eines zweiten Arrays benutzen.
in php würde das so aussehen
$var [$var2[$var3]] [0]
in Smarty habe ich schon alles versucht, z.B. so
{$var.{$var2.$var3}.0}
Aber ich finde keine Lösung
Habt ihr mir hier eine Idee? |
|
Back to top |
|
ovnn Smarty Regular
Joined: 14 Apr 2010 Posts: 82 Location: Germany
|
Posted: Thu Dec 08, 2011 8:15 am Post subject: |
|
|
{$foo.$bar.$baz} |
|
Back to top |
|
mjimmy Smarty Rookie
Joined: 07 Dec 2011 Posts: 8
|
Posted: Thu Dec 08, 2011 9:57 am Post subject: Funktioniert so nicht |
|
|
Da in der Mitte auf den INdex eines Arrays über eine Variable verwiesen wird, geht das so nicht.
Hat jemand einen anderen vorschlag? |
|
Back to top |
|
U.Tews Administrator
Joined: 22 Nov 2006 Posts: 5068 Location: Hamburg / Germany
|
Posted: Thu Dec 08, 2011 3:21 pm Post subject: |
|
|
In smarty 3 kannst du es wie in php schreiben.
{$var[$var2[$var3]][0] }
Für smarty 2 geht es nur mit einem Workaround
{assign var=foo vakue=$var2.var3}
{$var.$foo.0} |
|
Back to top |
|
mjimmy Smarty Rookie
Joined: 07 Dec 2011 Posts: 8
|
Posted: Wed Dec 21, 2011 9:24 am Post subject: |
|
|
WOW super,
danke für den Tipp.
|
|
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
|