| 12
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 
 | <?php
// Fonction fildarianise
function fildarianise(&$titres, $separateur=' | ')
{
/*
* $titres est un tableau associatif du genre :
* $titres = array(0=>'Accueil', 'cat1'=>'Catégorie 1', 'cat2'=>'Categorie 2', 'contact.html'=>'Contact', 'index.html'=>false);
*/
$baseUrl = 'http://'.$_SERVER['HTTP_HOST'];
$retour = '<span class="ariane"><a href=' . $baseUrl . '>' . $titres[0] . '</a></span>';
$chemin = explode("/", substr($_SERVER['PHP_SELF'], 1));
if (is_array($chemin)) foreach ($chemin as $k=>$v) if ($titres[$v] !== false)
{
$baseUrl .= "/$v";
$titre = isset($titres[$v]) ? $titres[$v] : $v;
$retour .= $separateur . '<a href=' . $baseUrl . '>' . $titre . '</a>';
}
return $retour;
}
// Un essai...
$titres = array(0=>'Index', 'cat1'=>'Catégorie 1', 'cat2'=>'Categorie 2', 'contact.html'=>'Contact', 'index.html'=>false);
echo fildarianise($titres);?> cette ligne sert a quoi ? | 
Partager