-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuscar.php
53 lines (36 loc) · 1.35 KB
/
buscar.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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<?php
if(!isset($_POST['busqueda'])){
header("Location: index.php");
}
?>
<?php require_once 'includes/cabecera.php'; ?>
<?php require_once 'includes/lateral.php'; ?>
<div id="contenedor">
<!-- CAJA PRINCIPAL -->
<div id="principal">
<h1>Busqueda: <?=$_POST['busqueda']?></h1>
<?php
$entradas = buscarEntradas($db, null, null, $_POST['busqueda'] );
if(!empty($entradas) && mysqli_num_rows($entradas) >=1):
while($entrada = mysqli_fetch_assoc($entradas)):
?>
<article class="entrada">
<a href="entrada.php?id=<?=$entrada['id'];?>">
<h2><?=$entrada['titulo']?></h2>
<span class="fecha"><?=$entrada['categoria']. ' | '.$entrada['fecha']?></span>
<p>
<!-- Con la función substr cortamos la cadena de la descripción -->
<?= substr($entrada['descripcion'], 0, 160)."..." ?>
</p>
</a>
</article>
<?php
endwhile;
else:
?>
<div class="alerta">No hay entradas en ésta cagegoría</div>
<?php endif;?>
</div><!-- Fin principal -->
<div class="clearfix"></div>
</div><!-- Fin del contenedor -->
<?php require_once 'includes/pie.php';?>