include("config.php");
function slugify($text)
{
	// replace non letter or digits by -
	$text = preg_replace('~[^\pL\d]+~u', '-', $text);
	// transliterate
	$text = iconv('utf-8', 'us-ascii//TRANSLIT', $text);
	// remove unwanted characters
	$text = preg_replace('~[^-\w]+~', '', $text);
	// trim
	$text = trim($text, '-');
	// remove duplicate -
	$text = preg_replace('~-+~', '-', $text);
	// lowercase
	$text = strtolower($text);
	if (empty($text))
	{
		return 'n-a';
	}
	return $text;
}
function data_it($data)
{
	// Creo una array dividendo la data YYYY-MM-DD sulla base del trattino
	$array = explode("-", $data);
	// Riorganizzo gli elementi in stile DD/MM/YYYY
	$data_it = $array[2]."/".$array[1]."/".$array[0];
	// Restituisco il valore della data in formato italiano
	return $data_it;
}
$query33  = "SELECT * FROM news order by data_news DESC limit 1 "  ;
if(!$result = $mysqli->query($query33)){ die('There was an error running the query [' . $mysqli->error . ']');}
$row33 = mysqli_fetch_array($result);
$titolo=utf8_encode($row33["titolo"]);
$titolos=slugify($titolo);
$testo=utf8_encode($row33["testo"]);
$data=$row33["data_news"];
$foto=$row33["foto1"];
$id=$row33["id"];
?>
                                    
 
                                     
									
										 echo  data_it($data); ?>
										
										 echo substr($testo,0,400).'...' ?>
										
										Vai alle News