Je liste un fichier .ini afin d'afficher la section en titre et les options en dessous. tout fonctionne bien mais je voudrais que lorsque qu'aucune options n'est présente, la catégorie ne soit pas affichée.
Voila le bout de code :
<?php
$tableauIni = parse_ini_file($fichier, TRUE);
foreach($tableauIni as $section_titre=>$section){
echo '<h4>';
echo htmlentities($section_titre);
echo'</h4>';
foreach($section as $key=>$val){
$idchp = explode (".", $key);
if($idchp[0] == 'A' && strpos($permgrp[0], $idchp[1]) === FALSE
OR $idchp[0] == 'B' && strpos($permgrp[1], $idchp[1]) === FALSE
OR $idchp[0] == 'C' && strpos($permgrp[2], $idchp[1]) === FALSE
OR $idchp[0] == 'D' && strpos($permgrp[3], $idchp[1]) === FALSE
OR $idchp[0] == 'E' && strpos($permgrp[4], $idchp[1]) === FALSE
OR $idchp[0] == 'F' && strpos($permgrp[5], $idchp[1]) === FALSE
OR $idchp[0] == 'G' && strpos($permgrp[6], $idchp[1]) === FALSE
OR $idchp[0] == 'H' && strpos($permgrp[7], $idchp[1]) === FALSE
OR $idchp[0] == 'I' && strpos($permgrp[8], $idchp[1]) === FALSE
OR $idchp[0] == 'J' && strpos($permgrp[9], $idchp[1]) === FALSE
OR $idchp[0] == 'K' && strpos($permgrp[10], $idchp[1]) === FALSE
OR $idchp[0] == 'L' && strpos($permgrp[11], $idchp[1]) === FALSE
OR $idchp[0] == 'M' && strpos($permgrp[12], $idchp[1]) === FALSE
OR $idchp[0] == 'N' && strpos($permgrp[13], $idchp[1]) === FALSE
OR $idchp[0] == 'O' && strpos($permgrp[14], $idchp[1]) === FALSE
) {
}else{
echo 'options';
}
}
}
pour résumer par rapport à ce bout de code, si la boucle ne passe par echo 'options'; je ne voudrais pas afficher le titre (echo htmlentities($section_titre);) plus haut dans la boucle.Merci de votre aide.