Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

Probleme mit Variablen Angabe

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Language: German
View previous topic :: View next topic  
Author Message
mjimmy
Smarty Rookie


Joined: 07 Dec 2011
Posts: 8

PostPosted: Wed Dec 07, 2011 2:06 pm    Post subject: Probleme mit Variablen Angabe Reply with quote

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


Joined: 14 Apr 2010
Posts: 82
Location: Germany

PostPosted: Thu Dec 08, 2011 8:15 am    Post subject: Reply with quote

{$foo.$bar.$baz}
Back to top
View user's profile Send private message
mjimmy
Smarty Rookie


Joined: 07 Dec 2011
Posts: 8

PostPosted: Thu Dec 08, 2011 9:57 am    Post subject: Funktioniert so nicht Reply with quote

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
View user's profile Send private message
U.Tews
Administrator


Joined: 22 Nov 2006
Posts: 5068
Location: Hamburg / Germany

PostPosted: Thu Dec 08, 2011 3:21 pm    Post subject: Reply with quote

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


Joined: 07 Dec 2011
Posts: 8

PostPosted: Wed Dec 21, 2011 9:24 am    Post subject: Reply with quote

WOW super,
danke für den Tipp.
Laughing
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    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