Browse Source

add manga to search/index

raylu 14 years ago
parent
commit
994c36b827
3 changed files with 48 additions and 17 deletions
  1. 3 3
      views/elements/animetable.html.php
  2. 29 0
      views/elements/mangatable.html.php
  3. 16 14
      views/search/index.html.php

+ 3 - 3
views/elements/animetable.html.php

@@ -6,12 +6,12 @@
 	<tr>
 		<td>
 			<a href="/anime/view/<?= $a->special_id ?>"><?= $a->title ?></a>
-			<?php if ($a->foreign_titles || $a->alternative_titles): ?>
+			<?php if (isset($a->foreign_titles) || isset($a->alternative_titles)): ?>
 				<span class="alt_titles">
-				<?php if ($a->foreign_titles): ?>
+				<?php if (isset($a->foreign_titles)): ?>
 					<?= $a->foreign_titles[0] ?>
 				<?php endif ?>
-				<?php if ($a->alternative_titles): ?>
+				<?php if (isset($a->alternative_titles)): ?>
 					&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 					<?= $a->alternative_titles[0] ?>
 				<?php endif ?>

+ 29 - 0
views/elements/mangatable.html.php

@@ -0,0 +1,29 @@
+<table>
+<th>Title</th>
+<th>Date</th>
+<th style="width: 200px">Type</th>
+<?php foreach ($manga as $m): ?>
+	<tr>
+		<td>
+			<a href="/manga/view/<?= $m->special_id ?>"><?= $m->title ?></a>
+			<?php if (isset($m->foreign_titles) || isset($m->alternative_titles)): ?>
+				<span class="alt_titles">
+				<?php if (isset($m->foreign_titles)): ?>
+					<?= $m->foreign_titles[0] ?>
+				<?php endif ?>
+				<?php if (isset($m->alternative_titles)): ?>
+					&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+					<?= $m->alternative_titles[0] ?>
+				<?php endif ?>
+				</span>
+			<?php endif ?>
+		</td>
+		<td>
+			<?= $m->publish_period ?>
+		</td>
+		<td>
+			<?= $m->author ?>
+		</td>
+	</tr>
+<?php endforeach ?>
+</table>

+ 16 - 14
views/search/index.html.php

@@ -5,27 +5,29 @@ $this->styles($this->html->style('search'));
 
 <?= $this->_render('element', 'search') ?>
 
+<?php if(count($anime) > 0): ?>
 <h2 class="ribbon">Anime</h2>
 <div class="triangle-ribbon"></div>
-<?= $this->_render('element', 'animetable', compact('anime')) ?>
-<p class="more">
-<a href="/search/anime/?q=<?= $q ?>">More</a>
-</p>
+	<?= $this->_render('element', 'animetable') ?>
+	<p class="more">
+	<a href="/search/anime/?q=<?= $q ?>">More</a>
+	</p>
+<?php endif ?>
 
+<?php if(count($manga) > 0): ?>
 <h2 class="ribbon">Manga</h2>
 <div class="triangle-ribbon"></div>
-<p>results</p>
-<?php if(count($manga) > 0): ?>
-<p class="more">
-<a href="/search/manga/?q=<?= $q ?>">More</a>
-</p>
+	<?= $this->_render('element', 'mangatable') ?>
+	<p class="more">
+	<a href="/search/manga/?q=<?= $q ?>">More</a>
+	</p>
 <?php endif ?>
 
+<?php if(count($kdrama) > 0): ?>
 <h2 class="ribbon">K-Drama</h2>
 <div class="triangle-ribbon"></div>
-<?= $this->_render('element', 'kdramatable', compact('anime')) ?>
-<?php if(count($kdrama) > 0): ?>
-<p class="more">
-<a href="/search/kdrama/?q=<?= $q ?>">More</a>
-</p>
+	<?= $this->_render('element', 'kdramatable') ?>
+	<p class="more">
+	<a href="/search/kdrama/?q=<?= $q ?>">More</a>
+	</p>
 <?php endif ?>