-
Notifications
You must be signed in to change notification settings - Fork 0
/
actualite.php
55 lines (55 loc) · 2.6 KB
/
actualite.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<?php include('include/head.php'); ?>
<?php include('include/menu.php'); ?>
<!-- Start Section
================================================== -->
<section class="section">
<div class="container">
<div class="row">
<div class="lp-element">
<h1>Actualités<br></h1>
<?php
require 'include/connectbdd.php';
if (!empty($_GET['url'])) {
$url = $_GET['url'];
$requete = "SELECT numActualite, titre, texte, date, url FROM actualite WHERE url = '$url';";
$req = $bdd->prepare($requete);
$req->execute();
$resultat = $req->fetch();
echo '<div class="tableauaccueil">';
echo ' <div style="float: left;">';
echo ' <strong>' . $resultat['titre'] . '</strong>';
echo ' </div><br><hr>';
echo $resultat['texte'];
echo '<br><div style="text-align: right;">';
echo '<strong>Publiée le ' . Outils::convertirEnDateFR(strtotime($resultat['date'])) . ' par l\'équipe du BDE</strong><br>';
echo '</div>';
echo '</div>';
}else{
$requete = 'SELECT numActualite, titre, texte, date, url FROM actualite ORDER BY date DESC';
$req = $bdd->prepare($requete);
$req->execute();
while ($row = $req->fetch()) {
echo '<div class="tableauaccueil">';
echo ' <div style="float: left;">';
echo ' <strong><a href="article/' .$row['url'].'/">' . $row['titre'] . '</a></strong>';
echo ' </div>';
echo ' <div style="float: right;">';
echo ' <strong>' . Outils::date_fr(strtotime($row['date']), 'l j F Y') . '</strong>';
echo ' </div><br><hr>';
$chaine = $row['texte'];
$len = 200;
echo $chaine = substr($chaine,0,$len) . "..." ;
echo '<p style="text-align: right;"><a href="article/' .$row['url'].'/">En savoir plus ››</a></p>';
echo '</div>';
}
}
$req->closeCursor();
?>
</div>
</div>
</div><br>
</section>
<!-- ==================================================
End Section -->
<br>
<?php include('include/footer.php'); ?>