|
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 |
jaimesks Smarty n00b
Joined: 13 Feb 2019 Posts: 2
|
Posted: Wed Feb 13, 2019 3:37 pm Post subject: array multidimensionales |
|
|
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 |
|
AnrDaemon Administrator
Joined: 03 Dec 2012 Posts: 1785
|
Posted: Wed Feb 13, 2019 3:45 pm Post subject: |
|
|
Then only assign to Smarty what you want to show.
Don't place business logic into template. |
|
Back to top |
|
jaimesks Smarty n00b
Joined: 13 Feb 2019 Posts: 2
|
Posted: Wed Feb 13, 2019 4:02 pm Post subject: |
|
|
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 |
|
AnrDaemon Administrator
Joined: 03 Dec 2012 Posts: 1785
|
Posted: Wed Feb 13, 2019 8:07 pm Post subject: |
|
|
Don't use for to iterate over datasets. Use foreach.
And read Smarty Documentation already.
https://www.smarty.net/docs/en/ |
|
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
|