Smarty Forum Index Smarty
The discussions here are for Smarty, a template engine for the PHP programming language.

array multidimensionales

 
Post new topic   Reply to topic    Smarty Forum Index -> General
View previous topic :: View next topic  
Author Message
jaimesks
Smarty n00b


Joined: 13 Feb 2019
Posts: 2

PostPosted: Wed Feb 13, 2019 3:37 pm    Post subject: array multidimensionales Reply with quote

I'm looking for a way to go through an array
example

{$miarray[3][0]}
{$miarray[3][1]}

{$miarray[7][0]}
{$miarray[7][1]}
{$miarray[7][2]}

{$miarray[37][0]}
{$miarray[37][1]}
{$miarray[37][2]}

I have a dynamic array that contains the id of the product orders and I would like to show only the products of a certain order number
Back to top
View user's profile Send private message
AnrDaemon
Administrator


Joined: 03 Dec 2012
Posts: 1572

PostPosted: Wed Feb 13, 2019 3:45 pm    Post subject: Reply with quote

Then only assign to Smarty what you want to show.
Don't place business logic into template.
Back to top
View user's profile Send private message
jaimesks
Smarty n00b


Joined: 13 Feb 2019
Posts: 2

PostPosted: Wed Feb 13, 2019 4:02 pm    Post subject: Reply with quote

AnrDaemon wrote:
Then only assign to Smarty what you want to show.
Don't place business logic into template.

I would like to do something like this in the smarty template

Code:
for ($i =0; $i < $varcoun; $i++)
{
   for ($j =0; $j < $varcoun2; $j++)
        {
          $myarray[$i][$j];
         }
}
Back to top
View user's profile Send private message
AnrDaemon
Administrator


Joined: 03 Dec 2012
Posts: 1572

PostPosted: Wed Feb 13, 2019 8:07 pm    Post subject: Reply with quote

Don't use for to iterate over datasets. Use foreach.

And read Smarty Documentation already.
https://www.smarty.net/docs/en/
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    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