diff options
author | Michael Francis <edude03@gmail.com> | 2011-07-01 01:03:50 -0400 |
---|---|---|
committer | Michael Francis <edude03@gmail.com> | 2011-07-01 01:03:50 -0400 |
commit | 9c1dfaeb624b2ce958b3a0784897d5ebc597b03c (patch) | |
tree | b23b322b334069d363ff198936fdc89594ac5f1f /views | |
parent | b099b7e6f2eda9b34177b9b08a8e668afcbf018c (diff) | |
download | otakuhub-9c1dfaeb624b2ce958b3a0784897d5ebc597b03c.tar.xz |
New column based search
Diffstat (limited to 'views')
-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> |