Créer un compte
Connexion

Script PHP pour derniers messages d'un forum

Pour créer et répondre aux sujets, vous devez être connecté.
Ce sujet est résolu.
Pages: 1
Auteur Message
Vincent37
30/11/2011 à 16:10:41
Vincent37
Membre
Bonjour à tous,

j'aimerai vos connaissances sur un codage php.

à l'adresse suivante vous trouverez un script que j'ai copier et bidouiller à ma sauce pour mon forum CLUB
http://grandtourisme.free.fr/phpBB3/newsARCF TESTE.php

hors comme vous pouvez le constater la derniere colonne qui doit faire apparaitre la date et heure du post apparait en codage timestamp .

Ma question comment convertir ce codage en date et heure lisible.

merci de votre aide.

Vincent

PS : Je colle le script que j'utilise

<?php
include ("config.php");

$link = mysql_connect (ftpperso.free.fr,grandtourisme,DDDDDDDD) or die ('Erreur : '.mysql_error() );
mysql_select_db(grandtourisme) 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 !='37' ORDER BY topic_last_post_time DESC limit 8";
$result = mysql_query($select,$link) or die ('Erreur : '.mysql_error() );

while($row = mysql_fetch_array($result))
{
$topic_id = $row['topic_id'];
$titre = $row['topic_title'];
$posteur = $row['topic_last_poster_name'];
$date = $row['topic_last_post_time'];



########## 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) >80) ? substr($titre, 0,80).'...' : $titre;
echo '<table border="0" width="710">

<tr>

<td width="100"><p style="font-size:13px; font-family:Arial; color : #FF6633">Sujet du topic</td>
<td width="380"><a style="font-size:13px; font-family:Arial; color : #00000" href="/phpBB3/viewtopic.php?t='.$topic_id.'" target="_top">'.ucfirst(strtolower($titre_lien)).'</a></td>
<td width="30"><p style="font-size:13px; font-family:Arial; color : #FF6633">par</td>
<td width="100"><a style="font-size:13px; font-family:Arial; color : #00000">'.$posteur.'</a></td>
<td width="100"><a style="font-size:13px; font-family:Arial; color : #00870">Le '.$date.'</a></td>

</tr>
</table>';}
mysql_free_result($result);
mysql_close();
?>



Spitfire 95
01/12/2011 à 06:24:40
Spitfire 95
Membre
<td width="100"><a style="font-size:13px; font-family:Arial; color : #00870">Le '.('d M y \à H\hi',$date).'</a></td>

Vincent37
01/12/2011 à 17:49:10
Vincent37
Membre
Merci pour votre réponse hélas,j'ai une erreur

Parse error: syntax error, unexpected ',' in /mnt/140/sdc/9/b/grandtourisme/phpBB3/newsARCF TESTE.php on line 39



Spitfire 95
01/12/2011 à 20:18:13
Spitfire 95
Membre
Vieux copié collé sans faire gaffe x)
Et comme ça :
<td width="100"><a style="font-size:13px; font-family:Arial; color : #00870">Le '.("d M y \à H\hi",$date).'</a></td>

Vincent37
01/12/2011 à 21:01:32
Vincent37
Membre
Non désolé toujours pas. besoin d'autre info peut être ??

Spitfire 95
01/12/2011 à 22:10:47
Spitfire 95
Membre
Mon copié collé de mon code s'est pas fait entièrement donc forcément il manque un morceau de code ^^'

<td width="100"><a style="font-size:13px; font-family:Arial; color : #00870">Le '.date("d M y \à H\hi",$date).'</a></td>

Vincent37
01/12/2011 à 23:08:59
Vincent37
Membre
MILLES MERCI , très sympa je vais le mettre sur le site du club tout de suite !

http://arcf37.free.fr

merci encore !!!

Pages: 1