1
someone has some idea of how I can leave the menu marked according to the user’s page, I made a way here, however and much check, taking into account that I have several pages, vo posted as I did
if(isset($urlE[1]) && $urlE[1] == 'a'){
echo '
<li><a href="'.$urlBase.'" style="width:45px;border-radius:2px;">HOME</a></li>
<li><a href="javascript:void(0)" class="ativo">A</a></li>
<li><a href="'.$urlBase.'/filtragem/b">B</a></li>
<li><a href="'.$urlBase.'/c">C</a></li>
<li><a href="'.$urlBase.'/d">D</a></li>
<li><a href="'.$urlBase.'/e">E</a></li>
<li><a href="'.$urlBase.'/f">F</a></li>
<li><a href="'.$urlBase.'/g">G</a></li>
<li><a href="'.$urlBase.'/h">H</a></li>
<li><a href="'.$urlBase.'/i">I</a></li>
<li><a href="'.$urlBase.'/j">J</a></li>
<li><a href="'.$urlBase.'/k">K</a></li>
<li><a href="'.$urlBase.'/l">L</a></li>
<li><a href="'.$urlBase.'/m">M</a></li>
<li><a href="'.$urlBase.'/n">N</a></li>
<li><a href="'.$urlBase.'/o">O</a></li>
<li><a href="'.$urlBase.'/p">P</a></li>
<li><a href="'.$urlBase.'/q">Q</a></li>
<li><a href="'.$urlBase.'/r">R</a></li>
<li><a href="'.$urlBase.'/s">S</a></li>
<li><a href="'.$urlBase.'/t">T</a></li>
<li><a href="'.$urlBase.'/u">U</a></li>
<li><a href="'.$urlBase.'/v">V</a></li>
<li><a href="'.$urlBase.'/w">W</a></li>
<li><a href="'.$urlBase.'/x">X</a></li>
<li><a href="'.$urlBase.'/y">Y</a></li>
<li><a href="'.$urlBase.'/z">Z</a></li>
';
}elseif(isset($urlE[1]) && $urlE[1] == 'b'){
echo '
<li><a href="'.$urlBase.'" style="width:45px;border-radius:2px;">HOME</a></li>
<li><a href="'.$urlBase.'/filtragem/a">A</a></li>
<li><a href="javascript:void(0)" class="ativo">B</a></li>
<li><a href="'.$urlBase.'/filtragem/c">C</a></li>
<li><a href="'.$urlBase.'/filtragem/d">D</a></li>
<li><a href="'.$urlBase.'/filtragem/e">E</a></li>
<li><a href="'.$urlBase.'/filtragem/f">F</a></li>
<li><a href="'.$urlBase.'/filtragem/g">G</a></li>
<li><a href="'.$urlBase.'/filtragem/h">H</a></li>
<li><a href="'.$urlBase.'/filtragem/i">I</a></li>
<li><a href="'.$urlBase.'/filtragem/j">J</a></li>
<li><a href="'.$urlBase.'/filtragem/k">K</a></li>
<li><a href="'.$urlBase.'/filtragem/l">L</a></li>
<li><a href="'.$urlBase.'/filtragem/m">M</a></li>
<li><a href="'.$urlBase.'/filtragem/n">N</a></li>
<li><a href="'.$urlBase.'/filtragem/o">O</a></li>
<li><a href="'.$urlBase.'/filtragem/p">P</a></li>
<li><a href="'.$urlBase.'/filtragem/q">Q</a></li>
<li><a href="'.$urlBase.'/filtragem/r">R</a></li>
<li><a href="'.$urlBase.'/filtragem/s">S</a></li>
<li><a href="'.$urlBase.'/filtragem/t">T</a></li>
<li><a href="'.$urlBase.'/filtragem/u">U</a></li>
<li><a href="'.$urlBase.'/filtragem/v">V</a></li>
<li><a href="'.$urlBase.'/filtragem/w">W</a></li>
<li><a href="'.$urlBase.'/filtragem/x">X</a></li>
<li><a href="'.$urlBase.'/filtragem/y">Y</a></li>
<li><a href="'.$urlBase.'/filtragem/z">Z</a></li>
';
}
and so on, is there any way to make it cleaner? it has to be in php, because the refresh page
yeah, I got it
$urlAtual = $urlE[1];
 for ($i=0; $i < 26; $i++){
 $letra = Chr(97+$i);
 if($urlAtual = $letra){
 if(isset($urlE[1]) && $urlE[1] == $letra){
 echo "<li><a href='".$urlBase."/filtragem/".$letra."' class='ativo' style='text-transform:capitalize;'>".$urlAtual."</a></li>".PHP_EOL;
 }else{ 
 echo "<li><a href='".$urlBase."/filtragem/".$letra."' style='text-transform:capitalize;'>".$urlAtual."</a></li>".PHP_EOL;
 }
 }
 }
, you and beast, likezao– goio
Try to understand how it works, it’s important for you to improve your code in other parts in the future. Don’t just adapt, try to understand.
– Bacco
I have one more menu, so I understood this line
$letra=Chr(97+$i);
generates the alphabet, as I would mark the menu that its url and sohttp://localhost/local/genero/acao
, how I would change the valueacao
– goio
You can use an array of words and a
foreach
https://ideone.com/3LKMo9 - updated the response– Bacco