index.html.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <?php
  2. //table helper
  3. function table($data, array $headers = array(), array $options = array()) {
  4. //Create the table
  5. echo '<tr>';
  6. foreach ($headers as $k => $v)
  7. {
  8. echo "<th>$v</th>";
  9. }
  10. echo "</tr>\n";
  11. foreach ($data as $item)
  12. {
  13. echo '<tr>';
  14. foreach($headers as $key => $value)
  15. {
  16. echo '<td>';
  17. echo $item->$key;
  18. echo '</td>';
  19. }
  20. echo "</tr>\n";
  21. }
  22. }
  23. ?>
  24. <div class="container_12">
  25. <div class="grid_4">
  26. <h2> Search options </h2>
  27. <hr />
  28. <?= $this->form->create(null, array('method' => 'get')); ?>
  29. <?= $this->form->field('search', array('type' => 'textbox', 'class' => 'sidebar-search', 'style' => 'width:200px')); ?>
  30. <?= $this->form->label('type', 'For:'); ?>
  31. <?= $this->form->select('type', array('Anime' => 'Anime',
  32. 'Manga' => 'Manga',
  33. 'Kdrama' => 'Kdrama')); ?>
  34. <?= $this->form->submit('Search', array('style' => 'width: 100px')); ?>
  35. <?= $this->form->end(); ?>
  36. </div>
  37. <div class="grid_8">
  38. <h2>Search Results</h2>
  39. <hr />
  40. <table class="table">
  41. <?php table($content, $headers); ?>
  42. </table>
  43. <?=$this->Paginator->paginate(array('separator' => '', 'action' => 'index/anime')); ?>
  44. </div>
  45. <br class="cl">
  46. </div>