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

I have a BIG problem with arrays

 
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 -> General
View previous topic :: View next topic  
Author Message
Nibble
Smarty n00b


Joined: 22 May 2003
Posts: 1

PostPosted: Thu May 22, 2003 9:02 am    Post subject: I have a BIG problem with arrays Reply with quote

Hi!

I'm getting crazy with smarty syntax.

If we have an associative index in an array we must use the point separator but if we want to specify an internal index we must use the brackets []. Is this correct?

OK... now... what happens if we have an array with associative indexes in a level and internal indexes in a sub-level ?


Could we do something like
Code:
$matrix.links[2].nav_id
???

answer: NO, or at least I don't know how to make it work.
Back to top
View user's profile Send private message
Escariion
Smarty Rookie


Joined: 14 May 2003
Posts: 7
Location: Berlin, Germany

PostPosted: Thu May 22, 2003 11:37 am    Post subject: Reply with quote

i use [$var] for numeric index
and .$var for string index

is this your array:?
Code:

$matrix = array(
  'links'=>array(
    2=>array(
      'nav_id'
    )
  )
);
Back to top
View user's profile Send private message
Enquest
Smarty Regular


Joined: 14 May 2003
Posts: 79

PostPosted: Fri May 23, 2003 7:00 am    Post subject: Reply with quote

I think it should work...
Could the last replyer tell me how to us $var?
Back to top
View user's profile Send private message
Escariion
Smarty Rookie


Joined: 14 May 2003
Posts: 7
Location: Berlin, Germany

PostPosted: Fri May 23, 2003 10:01 am    Post subject: Reply with quote

hm ok use it without $ Smile
{$one_var.var}
{$one_var[var]}
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 -> General 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