I am doing a practical work for the faculty, in which I have to put together a web page of a given subject, doing the navigation by model of templates.
The main page contains its navigation bar in 3 sections, making the isset
of what arrives by get and making the include
of each template works perfect.
The problem comes when I am inside the second section, which in this case is called "instruments" and I have a sub navigation bar. In that section that has as buttons the types: "wind", "strings", "percussion" ... In this template, in principle all the instruments must be shown, bringing them from an array (this is already done, they are perfectly displayed ), but when clicking on any of the buttons, only those that correspond should appear. If you click on wind, you should only show the wind and so, but this must occur without including a new template.
I understand that I must pass a new parameter by get, but I can not get the instruments of the requested type displayed.
The array is like this:
$instrumentos = array(
array(
'nombre' => 'Bajo Barriltono',
'descripcion' => 'Fue construido por Carlos Iraldi como una parodia del contrabajo. La caja armónica es un gran barril sobre el que va adosada la tastiera con las cuerdas. Para ejecutar este instrumento el músico debe introducirse dentro del barril sacando los brazos por la parte superior. Posee además 5 ruedas en la parte inferior que permiten al ejecutante ir caminando mientras toca el instrumento. Su intérprete es Jorge Maronna y se lo puede ver en la obra "San Ictícola de los peces" del espectáculo Unen canto con humor.',
'tipo' => 'Cuerdas',
'foto' =>'bajo_barriltono.jpg'
),
What is sent by url should look something like this, right?
<li><a href="index.php?cat=instr&tipo=cuerda">Cuerda</a></li>
What evaluation should I do to bring only those of each type?
It is not allowed to use js, jquery, anything that is not PHP. The view of the section is as follows:
<section id="instrumentos">
<div>
<h2>Instrumentos</h2>
<nav>
<ul>
<li><a href="index.php?cat=instr&tipo=cuerda">Cuerda</a></li>
<li><a href="index.php?cat=instr&tipo=viento">Viento</a></li>
<li><a href="index.php?cat=instr&tipo=percu">Percusión</a></li>
</ul>
</nav>
</div>
<div class="grilla_instrumentos">
<?php
foreach($instrumentos as $item => $instru){
echo '<div class="instrumento">';
echo '<h3>'.$instru['nombre'].'</h3>';
echo '<img src="recursos/img/'.$instru['foto'].'"/>';
echo '<p><a href="index.php?cat=ver&i='.$item.'">VER MAS</a></p>';
echo '</div>';
}
?>
</div>
</section>