You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

97 lines
2.7 KiB

<?php
$q = mysqli_query($conn, "SELECT COUNT(id) FROM news");
$r = mysqli_fetch_array($q);
$totNews = $r[0];
$itemsPage = 5;
$currentPage = $getQ[1];
$totPages = $totNews/$itemsPage;
$pageStart = $currentPage * $itemsPage;
if($getQ[2]){
$q = mysqli_query($conn, "SELECT * FROM news WHERE id=".$getQ[2]);
$r = mysqli_fetch_array($q);
?>
<div class="row news">
<div class="col-12">
<div class="section-title">Notizie dall'Ordine</div>
<div class="section-text">
<p class="item py-3 h6"><span class="date"><?php echo conv_date($r['date']);?></span> - <?php echo $r['title'];?></p>
<p class="p-2"><?php echo $r['text'];?></p>
<?php
if($r['append']){
echo "<div class=\"append\">";
echo "<div class=\"item pt-4 font-bold\">Allegati:</div>";
$qa = mysqli_query($conn, "SELECT * FROM files WHERE id IN(".$r['append'].")");
while($ra = mysqli_fetch_array($qa)){
echo "<div class=\"item\"><a href=\"$BASE_URL".$ra['path']."/".$ra['filename']."\" target=\"_blank\">".$ra['title']."";
echo "<div class=\"size\">".$ra['size']."</div>";
echo "</a></div>";
}
echo "</div>";
}
?>
</div>
</div>
<div class="col-12 p-4">
<?php
@include 'social.php';
@include 'fb_comments.php';
?>
</div>
<div class="col-6 p-3">
<a onClick="javascript:history.back()">
<button><i class="fa fa-angle-left"></i> Torna indietro</button>
</a>
</div>
<div class="col-6 p-3 text-right">
<a href="<?php echo $BASE_URL."/news";?>">
<button>Vai a tutte le news <i class="fa fa-angle-right"></i></button>
</a>
</div>
</div>
<?php
}else{
?>
<div class="row news">
<div class="col-12">
<div class="section-title">Notizie dall'Ordine</div>
<?php
$q = mysqli_query($conn, "SELECT * FROM news ORDER BY date LIMIT $pageStart,$itemsPage");
while($r = mysqli_fetch_array($q)){
echo "<p class=\"item\"><a href=\"$BASE_URL/news/0/".$r['id']."/".conv_url($r['title'])."\"><span class=\"date\">".conv_date($r['date'])." </span> - ".$r['title']."</a></p>";
}
?>
</div>
<div class="col-12 my-2 pages">
<?php
for($i=0;$i<$totPages;$i++){
echo "<a class=\"font-12 ";
if($i==$currentPage){echo "selected";}
echo "\" href=\"$BASE_URL/news/$i\">".($i+1)."</a>";
}
?>
</div>
</div>
<?php
}
?>