|
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 |
joey Smarty Regular
Joined: 29 Oct 2003 Posts: 57
|
Posted: Thu Nov 06, 2003 7:31 am Post subject: how to solve it? |
|
|
$mylist and $status both are array.
$status[0] = "activate" ;
$status[1] = "deactivate";
$mylist are the result of mysql sql query
how to process two "[" ,like that: {$status[$mylist[row].status]}
Code: | {section name=row loop=$mylist}
<tr>
<td height="23"><div align="center">{$mylist[row].pnameCN}</div></td>
<td><div align="center">{$status[$mylist[row].status]}</div></td>
</tr>
{/section}
|
|
|
Back to top |
|
livingdead Smarty Rookie
Joined: 08 Oct 2003 Posts: 9
|
Posted: Wed Nov 12, 2003 1:14 pm Post subject: Same problem |
|
|
I got the same difficulty could you help please
Livingdead |
|
Back to top |
|
messju Administrator
Joined: 16 Apr 2003 Posts: 3336 Location: Oldenburg, Germany
|
Posted: Wed Nov 12, 2003 1:59 pm Post subject: Re: how to solve it? |
|
|
you cannot use these values directly (unfortunately) so you have to assign an intermediate value:
Code: | {section name=row loop=$mylist}
{assign var=status_value value=$mylist[row].status}
<tr>
<td height="23"><div align="center">{$mylist[row].pnameCN}</div></td>
<td><div align="center">{$status.$status_value}</div></td>
</tr>
{/section}
|
|
|
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
|