diff options
-rw-r--r-- | views/Search/index.html.php | 31 |
1 files changed, 27 insertions, 4 deletions
diff --git a/views/Search/index.html.php b/views/Search/index.html.php index 70a6315..91bc1fa 100644 --- a/views/Search/index.html.php +++ b/views/Search/index.html.php @@ -1,3 +1,29 @@ +<?php + +//table helper +function table($data, array $headers = array(), array $options = array()) { + //Create the table + echo '<tr>'; + foreach ($headers as $k => $v) + { + echo "<th>$v</th>"; + } + echo "</tr>\n"; + + + foreach ($data as $item) + { + echo '<tr>'; + foreach($headers as $key => $value) + { + echo '<td>'; + echo $item->$key; + echo '</td>'; + } + echo "</tr>\n"; + } +} +?> <div class="container_12"> <div class="grid_4"> @@ -16,10 +42,7 @@ <h2>Search Results</h2> <hr /> <table class="table"> - <tr><th>img</th><th>Name</th><th>Episodes</th><th>Type</th><th>Score</th></tr> - <?php foreach($content as $item): ?> - <tr><td>"image"</td><td><a href="/anime/view/<?= $item->special_id ?>"><?= $item->title ?></a></td> <td><?= $item->episode_count ?></td><td><?= $item->view_type ?></td><td><?= $item->mal_score ?></td></tr> - <?php endforeach; ?> + <?php table($content, $headers); ?> </table> <?=$this->Paginator->paginate(array('separator' => '', 'action' => 'index/anime')); ?> </div> |