forked from Fecsio/WeBotanic
-
Notifications
You must be signed in to change notification settings - Fork 0
/
eventi.php
36 lines (30 loc) · 1.29 KB
/
eventi.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<?php
$query = "SELECT Id, DataInizio, DataFine, Nome, Descrizione, Immagine, Alt FROM Eventi WHERE DataFine > CURDATE() ORDER BY DataFine ";
require "php/connessione.php";
$output = $connessione->query($query);
$head = file_get_contents("templates/headEventi.txt");
$foot = file_get_contents("templates/footEventi.txt");
echo $head;
$stampa = "<div id=\"content\">";
if(!$output) $stampa .= servError();
else {
if($output->num_rows == 0)
$stampa .= "<p> Nessuna evento trovato </p>";
else
foreach($output as $campo => $cont) {
$oldDF = $cont['DataFine'];
$DF = date("d-m-Y", strtotime($oldDF));
$oldDI = $cont['DataInizio'];
$DI = date("d-m-Y", strtotime($oldDI));
$stampa .= "<div class=\"notizie_eventi\"> <h2 id=\"id".$cont['Id']."\">".$cont['Nome']."</h2> <span> Data Inizio: ".$DI."</span> <span> Data Fine: ".$DF."</span>\n";
if(!empty($cont['Immagine']))
$stampa .= "<img src=\"images/".$cont['Immagine']."\" alt=\"".$cont['Alt']."\" /> \n";
$stampa .= "<p>".$cont['Descrizione']."</p> </div>";
}
$stampa .= "<p id=\"tornasu\"><a href= \"#header\">Torna a inizio pagina</a></p>";
}
$stampa .= "\n</div>";
echo $stampa;
echo $foot;
$connessione->close();
?>