Skip to content

Instantly share code, notes, and snippets.

@rodrigophpweb
Created May 13, 2024 18:01
Show Gist options
  • Save rodrigophpweb/a4d3542982f391734a206f9b840ab615 to your computer and use it in GitHub Desktop.
Save rodrigophpweb/a4d3542982f391734a206f9b840ab615 to your computer and use it in GitHub Desktop.
Code Refactoring Categories A to Z
<?php
$letters = range('a', 'z'); // Array com todas as letras do alfabeto
foreach ($letters as $letter) {
$title = "Serviços que começam com a letra $letter - " . TITLE_GERAL;
$active = (isset($varCliente) && $varCliente == $letter) ? '<span class="active">' . $letter . '</span>' : $letter;
$href = ($letter != 'todos') ? "/servicos/{$varCidade}/{$letter}" : "/servicos/{$varCidade}";
echo "<a href=\"{$href}\" title=\"{$title}\">{$active}</a>";
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment