<?php
	require_once ('../common/scripts/templatize.inc.php');
include ("../common/scripts/connect.inc.php"); 
/*******************************/
/*reinitialisation du login/mdp*/
/*******************************/

	session_start();
	$_SESSION['login'] = '';
	$_SESSION['password'] = '';
//affichageNews();
/**************/
/*affichage   */
/**************/
function affichageNews() {
global $dbconn,$listeNews;
//-----------  Declaration template  ------------------ //
$listeNews = new Template(".");
$listeNews->set_file("listeAnnonce","listeAnnonces.tpl");
//-----------  Declaration des blocks------------------ //
$listeNews->set_block("listeAnnonce","LISTE_ANNONCES","listeAnnonces");
//----------- Appels des fonctions --------------------//
affichageMessages();
//------------- ecriture fichier ---------------------//
$listeNews->parse("output","listeAnnonce");
$listeNews->p("output");
}

function affichageMessages(){
global $dbconn,$listeNews;

//$q=pg_query($dbconn,"select * from announce where ground_id='$terrier'order by announce_date_depot DESC ");
$q=pg_query($dbconn,"select * from news");
$cpt=0;
while($ligne=pg_fetch_array($q)) {
	$listeNews->set_var("id",$ligne['id']);
	$listeNews->set_var("date",$ligne['date']);
	$listeNews->set_var("message",$ligne['message']);
	$listeNews->set_var("auteur",$ligne['auteur']);
	if($cpt%2==0)$listeNews->set_var("atchoum","ligne1");
		else $listeNews->set_var("atchoum","ligne2");
		$cpt++;
	$listeNews->parse("listeAnnonces","LISTE_ANNONCES",true);
	}	
}


	templatize('../common/header.tpl','../common/menu.tpl','index.tpl','../common/footer.tpl');
?>		

