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 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142
|
<?php
class News extends Config {
public function __construct () {
Config :: MySQLDBPandoreWeb();
}
public function Pagination($table,$order) {
$this->MessagesParPage = 10;
$this->RetourTotalNews = mysql_query('SELECT COUNT(*) AS total FROM '.$table.'', $this->MySQLPandoreWeb) or die("".mysql_error()." Database Error: ".mysql_errno()."");
$this->DonnesTotalNews = mysql_fetch_assoc($this->RetourTotalNews);
$this->RetourTotal = $this->DonnesTotalNews['total'];
$this->NombreDePages = ceil($this->RetourTotal / $this->MessagesParPage);
if(isset($_GET['Pages'])) {
$this->PageActuelle = intval($_GET['Pages']);
if($this->PageActuelle > $this->NombreDePages) {
$this->PageActuelle = $this->NombreDePages;
}
}
else {
$this->PageActuelle = 1;
}
$this->PremiereEntree = ($this->PageActuelle - 1) * $this->MessagesParPage;
$this->RetourFinal = mysql_query('SELECT * FROM '.$table.' ORDER BY '.$order.' DESC LIMIT '.$this->PremiereEntree.', '.$this->MessagesParPage.'') or die("Database Error: ".mysql_errno()." : ".mysql_error());
}
public function Affichage() {
News::Pagination('news','dates');
while ($this->ResultatForumPostReponse = mysql_fetch_assoc($this->RetourFinal)) {
echo ('<div id="news">
<div id="newsheader"><div id="newsheadertexte">'.$this->ResultatForumPostReponse['titre'].'</div></div>');
echo ('<div id="newsback">
<div id="newsbackheader">
</div>
<div id="newsbackbody">
<div id="texte">'.$this->ResultatForumPostReponse['message'].'
</div>
</div>
<div id="newsbackfooter">
</div>
<br />
<div id="newsbackheader">
</div>
<div id="newsbackbody">
<div id="texte">Par '.$this->ResultatForumPostReponse['auteur'].' le '.$this->ResultatForumPostReponse['dates'].'');
if ($this->ResultatForumPostReponse['maj'] == 1) {
echo ('<div id="right">Mise à jour par '.$this->ResultatForumPostReponse['auteurmaj'].' le '.$this->ResultatForumPostReponse['datesmaj'].'</div>');
}
else {
}
echo ('
</div>
</div>
<div id="newsbackfooter">
</div>
</div>
<div id="newsbas"></div>
</div>');
}
echo ('<div id="news"><div id="newsheader"><div id="newsheadertexte"><div id="centre">');
$this->PrecedanteVariable = $this->PageActuelle - 1; // numéro de la page précédente
$this->SuivanteVariable = $this->PageActuelle + 1; // numéro de la page suivante
if ($this->PageActuelle > 1) {
$this->Precedant = '<a href="?Page=Accueil&Pages='.$this->PrecedanteVariable.'">Précédante</a>';
}
else {
$this->Precedant = '';
}
echo ('<div id="left">'.$this->Precedant.'</div> Pages ');
for($this->ip = 1; $this -> ip <= $this->NombreDePages; $this->ip ++) {
if($this->ip == $this->PageActuelle) {
echo ' ['.$this->ip.']';
}
else {
echo (' <a href="?Page=Accueil&Pages='.$this->ip.'">'.$this->ip.'</a>');
}
}
echo (' sur ['.$this->NombreDePages.']');
if ($this->PageActuelle < $this->NombreDePages) {
$this->Suivant = '<a href="?Page=Accueil&Pages='.$this->SuivanteVariable.'">Suivante</a>';
}
else {
$this->Suivant = '';
}
echo ('<div id="right">'.$this->Suivant.'</div>');
echo ('</div></div></div><div id="newsbas"></div></div>');
}
}
?> |
Partager