<?php
  include __DIR__ . "/../layout/header_drop.php";
//  include __DIR__ . "/../inc/foto_nav.php";
  include __DIR__ . "/../css/navi.css";
  include __DIR__ . "/../css/gallery_vorschau.css";

  $themen = $anz_themen = array();  // Themenunterschrift - Anzahl Bilder vom gleichen Thema
  $path_images = __DIR__ . "/../images/".$thema."/";
  $base_ordner = "/home/foto/views/images/";
  $unterordner = scandir($path_images);

  $i = 1;                     // 1. Bild
  $alles = array();
  $anz_themen[] = 0;
//  foreach($unter_thema AS $bild_thema){
  foreach($unterordner AS $bild_thema){
    if ($bild_thema != "." && $bild_thema != ".." && $bild_thema != "klein" && $bild_thema != "_notes" &&
      $bild_thema != ".DS_Store" && $bild_thema != "Thumbs.db") {
      $unter_thema[] = $bild_thema; // gültiges Unterthema
    //echo "</br>Thema: ".$bild_thema; echo "</br>";
    $ordner = $base_ordner.$thema."/".$bild_thema;

    //$ordner = $base_ordner.$thema."/".$bild_thema; //echo "<br".$ordner;
    $file_img = $path_images.$bild_thema."/"; //$file_img = $base_ordner.$bild_thema."/";
    $themen[] = $bild_thema;   //element an letzter stelle hizufügen
    $allebilder = scandir($file_img);

    foreach ($allebilder as $bild) {      //Ordner "images" auslesen
      $bildinfo = pathinfo($ordner."/".$bild);
      if ($bild != "." && $bild != ".." && $bild != "klein" && $bild != "_notes"
        && $bildinfo['basename'] != "Thumbs.db" && $bildinfo['basename'] != ".DS_Store") { ?>
        <style><?php
          echo ("#p".$i.",#p".$i." + span{background-image:url(".$ordner."/".$bild.")}");?>
        </style><?php
        $i++;
        $alles[] = $bild;
      }
    }
    $anz_themen[] = $i-1;   //anzahl bilder an letzter stelle hizufügen
  }
}
  $anz_images = $i; ?>
  <div id="myBtnContainer" style="padding-left:20px; top:0px; text-transform:capitalize;"><?php
      echo "&nbsp;<b>Thema &nbsp;".$thema.":</b>&nbsp;&nbsp;";?>
    <button input class="btn-default" type="button"><a href='<?php echo $thema."?carussel=00";?>'>zurück -> Einzelbilder</a></button>
  </div> <?php
//  $anz = count($unter_thema); //die();
  $anz = count($unterordner);
  $active = "class=\”active\"";
  $i = 0;   // 1. Bild
  $m = $b = 0;   // $m = 1. Matrix-Eintrag
  $nr = $i; // 1. Bild

  include __DIR__ . "/../inc/carussel_body.php";?>

  <div>
    <div class="container"> <!--  <h2>Carousel Example</h2> -->
      <div id="myCarousel" class="carousel slide" data-ride="carousel">
      </div>
    </div>
  </div>
  <div>
    <button input class="btn-default" type="button">
      <a href='<?php echo $thema."?carussel=00";?>'>zurück -> Einzelbilder</a></button>
  </div>
  <br>    <!-- leere Zeile unter dem Bild -->

<?php
    include __DIR__ . "/../js/gallery.js";
    include __DIR__ . "/../js/filter_1.inc.js";
    //include __DIR__ . "/../layout/footer.php";
?>