Voila ma page d'affichage des news avec mes 2 fameux bouton.
<?
function post($text) //Fonction de verification des formulaires de post avec ajout des smileys et adresses cliquables
{
$text = wordwrap($text, 150, " ", 1); //coupe les mots trop longs
$text = htmlentities($text);
$text=preg_replace("/(\[img\]www)(.[^\"\'\(\)\<\>\]\[]*?)(\[\/img\])/i", " <img src='http://www\\2' border=0> ", $text);
$text=preg_replace("/(\[img\])(.[^\"\'\(\)\<\>\]\[]*?)(\[\/img\])/i", " <img src='\\2' border=0> ", $text);
$text=preg_replace("/(\[url\]www)(.[^\"\'\(\)\<\>\]\[]*?)(\[\/url\])/i", "<a href=\"http://www\\2\">www\\2</a>", $text);
$text=preg_replace("/(\[url\]http)(.[^\"\'\(\)\<\>\]\[]*?)(\[\/url\])/i", "<a href=\"http\\2\">http\\2</a>", $text);
$text=preg_replace("/(\[url=(.[^\"\'\(\)\<\>\]\[]*?)\])(.*?)(\[\/url\])/i", "<a href=\"\\2\">\\3</a>", $text);
$text = str_replace('alert','!alert!',$text);
$text = str_replace('javascript','!javascript!',$text);
$text = str_replace('','<img src="admin/smileys/icon1.gif">',$text);
$text = str_replace('','<img src="admin/smileys/icon2.gif">',$text);
$text = str_replace(':o','<img src="admin/smileys/icon3.gif">',$text);
$text = str_replace('','<img src="admin/smileys/icon4.gif">',$text);
$text = str_replace('8)','<img src="admin/smileys/icon5.gif">',$text);
$text = str_replace(':|','<img src="admin/smileys/icon6.gif">',$text);
$text = str_replace(':?','<img src="admin/smileys/icon7.gif">',$text);
$text = str_replace(':#','<img src="admin/smileys/icon8.gif">',$text);
$text = str_replace(':8','<img src="admin/smileys/icon9.gif">',$text);
$text = str_replace(';(','<img src="admin/smileys/icon10.gif">',$text);
$text = str_replace(':p','<img src="admin/smileys/icon11.gif">',$text);
$text = str_replace('p)','<img src="admin/smileys/icon12.gif">',$text);
$text = str_replace('[hr]','<hr>',$text);
$text = str_replace('[hr]','<hr>',$text);
$text=preg_replace("/(\[couleur=([#a-zA-Z0-9]*)\])/i", "</span><span style=\"color:\\2\">", $text);
$text=preg_replace("/(\[\/#)(.*?)(\])/i", "</SPAN>", $text);
$text = str_replace('
Citation :
','<DIV class=comUserStat><SPAN class=comUserStatCaption>Citation :</SPAN><BR>',$text);
$text = str_replace('
|
','</DIV>',$text);
$text = str_replace('','<b>',$text);
$text = str_replace('','<u>',$text);
$text = str_replace('','<i><font size="1">',$text);
$text = str_replace('','</i>',$text);
$text = str_replace('[ /i]','</i>',$text);
$text = str_replace('','</b>',$text);
$text = str_replace('','</u>',$text);
$text = str_replace ('[glow]','<div style="width:100%;filter:glow(color=#000000,strength=1);">',$text) ;
$text = str_replace ('[/glow]','</div>',$text) ;
$text = str_replace('','<b>',$text);
$text = str_replace('','</b>',$text);
$text = str_replace('[cpp]','<table border="1" cellspacing="0" cellpadding="0"><tr><td bgcolor="#FFFFFF">C++ :<font size="2"><br>',$text);
$text = str_replace('','</td></tr></table>',$text);
$text = nl2br($text);
$text = stripslashes($text);
return $text;
}
//bare des news
include("/home/techworl/public_html/admin/config.php" );
$connection= mysql_connect($host_db,$user_db,$password_db,$bdd_db);
$db=mysql_select_db($bdd_db,$connection);
$id=$_GET['sid'];
$sql = "SELECT * FROM news WHERE id='$id'";
$req = mysql_query($sql) or die('Erreur SQL !<br>'.$sql.'<br>'.mysql_error());
while ($data = mysql_fetch_array($req)) {
$titre = $data['titre'];
$texte = $data['texte'];
$date = $data['date'];
$idmi=$id-1;
$idma=$id+1;
echo '</br>';
echo '<table width="60%" height="5%" border="3"> <TD width="10%" bgcolor="#FFFFFF"><div align="center"></div>'.$date.'<td width="50%" bgcolor="#FFFFFF"><div align="center"></div>'.$titre.'';
echo '</table>';?>
<table width="60%" height="15%" border="3"><td width="50%" bgcolor="#FFFFFF"></div><? echo post($texte)?>;
<?
echo '</table>';
//recup idmax
$result = mysql_query("SELECT * FROM news ORDER BY id DESC LIMIT 0,1" );
$req2 = mysql_fetch_array($result);
$idmax = $req2["id"];
//condition idmax
if ($id==$idmax)
{
echo "<ol><A HREF=index.php>retour au sommaire<ol>";
}
else
{
echo '<ol><A HREF=news.php?sid='.$idma.'>news suivante</ol>';
}
//recup idmin
$result2 = mysql_query("SELECT * FROM news ORDER BY id ASC LIMIT 0,1" );
$req3 = mysql_fetch_array($result2);
$idmin = $req3["id"];
//condition idmin
if ($id==$idmin)
{
echo "<ol><A HREF=index.php>retour au sommaire<ol>";
}
else
{
echo '<ol><A HREF=news.php?sid='.$idmi.'>news precedente</ol>';
}
}
mysql_free_result ($req);
mysql_close ();
?>[/cpp]
concretement en code jle fait comment parce que jai pas trop compris ton astuce?
---------------
p4w4