-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcategoria.php
43 lines (37 loc) · 1.35 KB
/
categoria.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
<?php require_once 'includes/conexion.php' ?>
<?php require_once 'includes/helpers.php' ?>
<?php
$categoria_actual = conseguirCategoria($db, $_GET['id']);
if(!isset($categoria_actual['id'])){
header("Location: index.php");
}
?>
<?php require_once 'includes/cabecera.php' ?>
<?php require_once 'includes/lateral.php' ?>
<!-- CAJA PRINCIPAL -->
<div id="principal">
<h1>Entradas de <?=$categoria_actual['nombre']?></h1>
<?php
$entradas = conseguirEntradas($db, null, (int)$_GET['id']);
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>
<?=substr($entrada['descripcion'], 0, 200)."..."?>
</p>
</a>
</article>
<?php
endwhile;
else:
?>
<div class="alerta">No hay entradas en esta categoria.</div>
<?php
endif;
?>
</div> <!-- Fin PRINCIPAL -->
<?php require_once 'includes/pie.php'; ?>