<?php
require_once("includes/categorias.php");


$categoria = "Ofertas";
$subcategoria = 1;

if (isset($_GET['subcategoria']) && isset($_GET['cat'])) {
	$categoria = $_GET['cat'];
	$subcategoria = $_GET['subcategoria'];
}

require_once("includes/p_" . $categoria . "_" . $subcategoria . ".php");
?>
<!DOCTYPE HTML>
<html>

<head>
	<title>Editorial by HTML5 UP</title>
	<meta charset="utf-8" />
	<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no" />
	<link rel="stylesheet" href="assets/css/main.css" />
</head>

<body class="is-preload">

	<!-- Wrapper -->
	<div id="wrapper">

		<!-- Main -->
		<div id="main">
			<div class="inner">

				<!-- Header -->
				<header id="header">
					<a href="index.html" class="logo"><strong>Editorial</strong> by HTML5 UP</a>
					<ul class="icons">
						<li><a href="#" class="icon brands fa-twitter"><span class="label">Twitter</span></a></li>
						<li><a href="#" class="icon brands fa-facebook-f"><span class="label">Facebook</span></a></li>
						<li><a href="#" class="icon brands fa-snapchat-ghost"><span class="label">Snapchat</span></a></li>
						<li><a href="#" class="icon brands fa-instagram"><span class="label">Instagram</span></a></li>
						<li><a href="#" class="icon brands fa-medium-m"><span class="label">Medium</span></a></li>
					</ul>
				</header>





				<!-- Section -->
				<section>
					<header class="major">
						<h2><?php echo $categoria; ?></h2>
					</header>
					<div class="posts">
						<?php
						foreach ($productos as $key => $value) {
						?>
							<article>
								<a href="#" class="image"><img src="images/<?php echo $categoria ?>/<?php echo $subcategoria ?>/<?php echo $key ?>.jpg" alt="" /></a>
								<h3><?php echo $value[0]; ?></h3>
								<p><?php echo $value[1]; ?></p>
								<ul class="actions">
									<li><a href="#" class="button">Ver Más</a></li>
								</ul>
							</article>
						<?php
						}
						?>
					</div>
				</section>

			</div>
		</div>

		<!-- Sidebar -->
		<div id="sidebar">
			<div class="inner">

				<!-- Search -->
				<section id="search" class="alt">
					<form method="post" action="#">
						<input type="text" name="query" id="query" placeholder="Search" />
					</form>
				</section>

				<!-- Menu -->
				<nav id="menu">
					<header class="major">
						<h2>Menu</h2>
					</header>
					<ul>
						<?php
						foreach ($categorias as $key => $value) {
						?>
							<li>
								<span class="opener"><?php echo $key; ?></span>
								<ul>
									<?php
									foreach ($value as $key2 => $value2) {
									?>
										<li><a href="index.php?cat=<?php echo $key; ?>&subcategoria=<?php echo $key2; ?>"><?php echo $value2; ?></a></li>
									<?php
									}
									?>
								</ul>
							</li>
						<?php
						}
						?>

					</ul>
				</nav>




				<!-- Footer -->
				<footer id="footer">
					<p class="copyright">&copy; Untitled. All rights reserved. Demo Images: <a href="https://unsplash.com">Unsplash</a>. Design: <a href="https://html5up.net">HTML5 UP</a>.</p>
				</footer>

			</div>
		</div>

	</div>

	<!-- Scripts -->
	<script src="assets/js/jquery.min.js"></script>
	<script src="assets/js/browser.min.js"></script>
	<script src="assets/js/breakpoints.min.js"></script>
	<script src="assets/js/util.js"></script>
	<script src="assets/js/main.js"></script>

</body>

</html>