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

tabelas dinâmicas

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


Joined: 27 Jul 2009
Posts: 1

PostPosted: Tue Jul 28, 2009 12:31 pm    Post subject: tabelas dinâmicas Reply with quote

Ola a todos, bom dia.

Estou com dificuldade pra montar uma tabela dinâmica com smarty.
A tabela tem que ser dinâmica tanto para colunas quanto para linhas.

O array para montar a tabela tem a seguinte estruta:

array(2) {
[0]=> array(3) {
["situacao"]=> int(12)
["taxa"]=> float(214.156)
["processo"]=> string(5) "19|35" }
[1]=> array(3) {
["situacao"]=> int(23)
["taxa"]=> float(165.078)
["processo"]=> int(36) }
}

Onde a coluna é a situação, e as linhas taxa e processos.
Eu to conseguindo montar com apenas duas linhas, a da situação e da taxa, mas os processos não consigo.
Estou fazendo desta maneira:
Code:

<table width="608" class="grid_resultado">
   <tr>
   {section name=i loop=$dados}
      {if (!empty($dados[i].situacao))}
      <td>{$dados[i].situacao|situacao}</td>
      {/if}
   {/section}
   </tr>
   {section name=y loop=$dados}
      {if (!empty($dados[y].taxa))}
      <td>{$dados[y].taxa}</td>
      {/if}
   {/section}   
         
</table>


Desde já agradeço e aguardo.

Obrigada.[/code]
Back to top
View user's profile Send private message
GersonGFPN
Smarty Rookie


Joined: 22 May 2009
Posts: 10

PostPosted: Fri Aug 14, 2009 5:16 pm    Post subject: Reply with quote

Eu fiquei um pouco confuso:

Code:

array(2) {
[0]=> array(3)
  {
       ["situacao"]=> int(12)
       ["taxa"]=> float(214.156)
       ["processo"]=> string(5) "19|35"
   }
[1]=> array(3) 
   {
       ["situacao"]=> int(23)
       ["taxa"]=> float(165.078)
       ["processo"]=> int(36)
   }
}

Certo? Pois bem, para acessar vc usaria o i como Indice e o nome de cada indice.. assim
Code:

{section name=i loop=$array}
   {$array[i].situacao}
   {$array[i].taxa}
   {$array[i].processo}
{/section}


Abraços.
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: Portuguese 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