|
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 |
Demerzel Smarty Rookie
Joined: 31 Jan 2010 Posts: 26
|
Posted: Sun Jan 31, 2010 6:27 pm Post subject: Odczytanie tablicy POST |
|
|
Mam następująca sytuację:
1. W jednym pliku za pomocą smartów zapisuje dane do tablicy POST
Code: | <TD>
od: <input type="text" name="{$a.id}[f311]" value="{if $a.datefrom}{$a.datefrom|date_format:"%Y/%m/%d"}{else}-{/if}" style="width:70px;"> <br>
do: <input type="text" name="{$a.id}[f312]" value="{if $a.dateto}{$a.dateto|date_format:"%Y/%m/%d"}{else}-{/if}" style="width:70px;">
</TD> |
Powyższy zapis sprawóje sie dobrze pod warunkiem, iz na sztywno zapisuje co chce odczytać:
Code: | <TD>od: {$post.2.f311}<BR>
do: {$post.2.f312}</TD> |
Problem stanowi zastąpienie sztywnego ustawienia cyfry 2 przez zmienną $a.id. Zapis $post.$a.id.f312 jak myśle oddaje cel jest jednak nieskuteczny. JAk w prawidłowy sposób w smartach odczytać taką tablicę? |
|
Back to top |
|
bordeux Smarty Rookie
Joined: 27 Jul 2010 Posts: 10
|
Posted: Wed May 30, 2012 11:00 am Post subject: |
|
|
Nie wiem jakim ci cudem działa
Aby dostać się do tablicy $_POST, używa się
Code: |
{$smarty.post.NAZWA}
|
Ale nie o to ci chodzi.
O to rozwiązanie
Code: |
{$smarty.post[$a.id].f312}
|
|
|
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
|