html.radios

Posledné novinky

Asi hotovo.

Takže, už to vyzerá byť dokončené. Od minula som pridal animovanie cez timer a možnosť upravovať...


14.12.2014 19:13
Kategória: Projekt key-framing a interpolácia

Prvá funkčná verzia

Po tejto sobote mám už prvý reálny výsledok. Viem nastavovať keyframe s pozíciou kamery, pohľadom...


14.12.2014 00:23
Kategória: Projekt key-framing a interpolácia
Choď do archívu >>

html.radios

Funkcia html.radios vytvára zoznam elementov <input type="radio" />.

Parameter Vyžadovaný Východzia hodnota Význam
name Áno

Názov radio elementov, akceptuje aj názov ako pole.

values Nie array()

Pole hodnôt a ich popisov. Formát:

array('hodnota' => 'popis', ...)

cols Nie 1

Počet stĺpcov, v ktorých sa vygeneruje zoznam radio elementov.

class Nie Reťazec: 'swift_radios'

Prefix pre názvy tried všetkých vygenerovaných elementov.

selected Nie NULL

Vybraná hodnota v zozname.

Príklad

Majme takýto php kód:

Zobraziť čistý text Zobraziť zvíraznený text
  1. <?php
  2. ...
  3.  
  4. $swift->assign('options', array(
  5. 0 => 'NULA',
  6. 1 => 'JEDNA',
  7. 2 => 'DVA',
  8. 3 => 'TRI',
  9. 4 => 'STYRI',
  10. 5 => 'PAT',
  11. 6 => 'SEST',
  12. 7 => 'SEDEM',
  13. 8 => 'OSEM',
  14. 9 => 'DEVAT',
  15. ));
  16.  
  17. ...
  18. ?>

A kód v šablóne:

Zobraziť čistý text Zobraziť zvíraznený text
  1. <div>{s:html.radios(name="myboxes[2]" values=$options cols=3 selected=3)}</div>

Výsledok:

Zobraziť čistý text Zobraziť zvíraznený text
  1. <div>
  2. <table class="swift_radios_table">
  3. <tr class="swift_radios_row_1">
  4. <td class="swift_radios_col_0">
  5. <input type="radio" name="myboxes[2]" value="0" id="id_myboxes_2_0" />
  6. <label for="id_myboxes_2_0">NULA</label>
  7. </td>
  8. <td class="swift_radios_col_1">
  9. <input type="radio" name="myboxes[2]" value="1" id="id_myboxes_2_1" />
  10. <label for="id_myboxes_2_1">JEDNA</label>
  11. </td>
  12. <td class="swift_radios_col_2">
  13. <input type="radio" name="myboxes[2]" value="2" id="id_myboxes_2_2" />
  14. <label for="id_myboxes_2_2">DVA</label>
  15. </td>
  16. </tr>
  17. <tr class="swift_radios_row_2">
  18. <td class="swift_radios_col_3">
  19. <input type="radio" name="myboxes[2]" value="3" checked="checked" id="id_myboxes_2_3" />
  20. <label for="id_myboxes_2_3">TRI</label>
  21. </td>
  22. <td class="swift_radios_col_4">
  23. <input type="radio" name="myboxes[2]" value="4" id="id_myboxes_2_4" />
  24. <label for="id_myboxes_2_4">STYRI</label>
  25. </td>
  26. <td class="swift_radios_col_5">
  27. <input type="radio" name="myboxes[2]" value="5" id="id_myboxes_2_5" />
  28. <label for="id_myboxes_2_5">PAT</label>
  29. </td>
  30. </tr>
  31. <tr class="swift_radios_row_3">
  32. <td class="swift_radios_col_6">
  33. <input type="radio" name="myboxes[2]" value="6" id="id_myboxes_2_6" />
  34. <label for="id_myboxes_2_6">SEST</label>
  35. </td>
  36. <td class="swift_radios_col_7">
  37. <input type="radio" name="myboxes[2]" value="7" id="id_myboxes_2_7" />
  38. <label for="id_myboxes_2_7">SEDEM</label>
  39. </td>
  40. <td class="swift_radios_col_8">
  41. <input type="radio" name="myboxes[2]" value="8" id="id_myboxes_2_8" />
  42. <label for="id_myboxes_2_8">OSEM</label>
  43. </td>
  44. </tr>
  45. <tr class="swift_radios_row_4">
  46. <td class="swift_radios_col_9">
  47. <input type="radio" name="myboxes[2]" value="9" id="id_myboxes_2_9" />
  48. <label for="id_myboxes_2_9">DEVAT</label>
  49. </td>
  50. <td class="swift_radios_col_empty"></td>
  51. <td class="swift_radios_col_empty"></td>
  52. </tr>
  53. </tbody>
  54. </table>
  55. </div>