Plus simple dès lors qu'on inclus pas common.php, car si non, c'est vraiment pas compliqué et réutilisable à souhait.
++
Modérateur: Modérateurs

<?php
include ("forum/config.php");
$link = mysql_connect ($dbhost,$dbuser,$dbpasswd) or die ('Erreur : '.mysql_error() );
mysql_select_db($dbname) or die ('Erreur :'.mysql_error());
$select = "SELECT topic_title,topic_id,topic_poster,forum_id,topic_last_poster_name,topic_last_post_time FROM phpbb_topics where forum_id !='38' ORDER BY topic_last_post_time DESC limit 30";
$result = mysql_query($select,$link) or die ('Erreur : '.mysql_error() );
while($row = mysql_fetch_array($result))
{
$topic_id = $row['topic_id'];
$titre = utf8_decode($row['topic_title']);
$posteur = $row['topic_last_poster_name'];
########## Début format URL ##########
$annonce= $titre;
$annonce = preg_replace("`\[.*\]`U","",$annonce);
$annonce = preg_replace('`&(amp;)?#?[a-z0-9]+;`i','-',$annonce);
$annonce = htmlentities($annonce, ENT_COMPAT, 'UTF-8');
$annonce = preg_replace( "`&([a-z])(acute|uml|circ|grave|ring|cedil|slash|tilde|caron|lig);`i","\\1", $annonce );
$annonce = preg_replace( array("`[^a-z0-9]`i","`[-]+`") , "-", $annonce);
$annonce = ( $annonce == "" ) ? $type : strtolower(trim($annonce, '-'));
########## Fin format URL ##########
$titre_lien= (strlen($titre) > 32) ? substr($titre, 0,60).' ' : $titre;
echo 'Sujet : <a href="/forum/'.$annonce.'-t'.$topic_id.'.html">'.ucfirst(strtolower($titre_lien)).'</a> - '.$posteur.'<br>';
}
mysql_free_result($result);
mysql_close();
?>

Retourner vers Développement de site
Utilisateurs parcourant ce forum: Aucun utilisateur enregistré et 5 invités