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



 
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
OmJFJ
Smarty Rookie


Joined: 29 Jul 2016
Posts: 5

PostPosted: Sun Jul 31, 2016 5:24 pm    Post subject: Reply with quote

hier mein Array:

Code:

[== smarty ==]
$array[0].item = '1'
$array[1].item = '2'
$array[2].item = '3'
...


Nun möchte ich den Wert vom nächsten Index mittels einer Variable haben: (mit counter)

Code:

[== smarty ==]
{counter assign=i start=1 print=false}
{foreach $array as $myArray}     
  var currentValue = {$myArray.item}; // currentValue = 1     
  var nextValue = {$array[$i].item}; // geht nicht, warum?
  var nextValue = {$array[1].item}; // nextValue = 2
  {$staticVar=1}
  var nextValue = {$array[$staticVar].item}; // nextValue = 2
  {counter}
{/foreach}


Im ersten Schleifendurchgang ist $i = 1, jedoch kann ich diese nicht für den Array Index verwenden
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