-
Notifications
You must be signed in to change notification settings - Fork 0
/
search.php
32 lines (24 loc) · 949 Bytes
/
search.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<?php
require_once("templates/header.php");
require_once("dao/MovieDAO.php");
// Dao dos Filmes
$movieDao = new MovieDAO($conn, $BASE_URL);
// Resgata input e faz a busca
$q = filter_input(INPUT_GET, "q");
$movies = $movieDao->findByTitle($q);
?>
<div id="main-container" class="container-fluid">
<h2 class="section-title" id="search-title">Você está buscando por: <span id="search-result"><?= $q ?></span></h2>
<p class="section-description">Resultados retornados baseados em sua busca.</p>
<div class="movies-container">
<?php foreach($movies as $movie): ?>
<?php require("templates/movie_card.php"); ?>
<?php endforeach; ?>
<?php if(count($movies) === 0): ?>
<p class="empty-list">Não há filmes para esta busca, <a class="back-link" href="<?= $BASE_URL ?>index.php">voltar</a>.</p>
<?php endif; ?>
</div>
</div>
<?php
include_once("templates/footer.php");
?>