Aller au contenu
View in the app

A better way to browse. Learn more.

Next

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

[RESOLU] Script news phpbb

Featured Replies

Posté(e)

Bonjour,

j'ai trouver ce scrip sur le net : http://www.j0k3r.net/php-des-news-sur-votr...a-phpbb-24.html

Je l'ai adapter a mon site ( mdp etc ) mais j'ai un probleme, il en maffiche qu'une news, et j'ai une ereur dans la requete, pourtant, quand j'execute la requete dans phpmyadminn tout vas bien. Voici le script:

<?
define('IN_PHPBB', true);
$phpbb_root_path = '../forum/';
$theme = 'subSilver';
include_once($phpbb_root_path.'includes/template.php');
include($phpbb_root_path.'includes/functions.php');
$template = new Template($phpbb_root_path.'templates/'.$theme);
include_once($phpbb_root_path.'includes/bbcode.php'); 

$host = 'localhost';
$user = 'teamdeclick_1';
$pass = 'XXX';
$bdd = 'teamdeclick_forum'; // votre base de donnée 

mysql_connect($host, $user, $pass);
mysql_select_db($bdd) or die('Impossible de se connecter'); 

$table_prefix = 'phpbb_';
$sql = "SELECT t.topic_id, t.forum_id, t.topic_title, t.topic_time, t.topic_replies, t.topic_last_post_id, t.topic_views, t.topic_vote, u.username, u.user_id, u.user_rank, u.user_sig, u.user_sig_bbcode_uid, u.user_allowsmile, p.*,  pt.post_text, pt.post_subject, pt.bbcode_uid
FROM " . $table_prefix. "forums f, " . $table_prefix. "topics t, " . $table_prefix. "posts p, " . $table_prefix. "users u, " . $table_prefix. "posts_text pt 
WHERE f.forum_news = '" . TRUE . "' 
	AND t.forum_id = f.forum_id 
	AND p.topic_id = t.topic_id 
	AND p.post_id = t.topic_first_post_id 
	AND pt.post_id = p.post_id 
	AND u.user_id = p.poster_id 
	AND t.topic_type = '0'
ORDER BY topic_time DESC";
echo $sql;
$req = mysql_query($sql);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr">
<head>
<title>j0k3r.n3t - Des news sur votre site grace à phpBB</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-15" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<meta http-equiv="Content-Language" content="fr" />
<link rel="StyleSheet" type="text/css" href="style.css" />
</head>
<div id="conteneur">		
<h1 id="header">
	<a href="http://www.j0k3r.net" onclick="window.open(this.href);return(false);"><img src="http://www.j0k3r.net/img/jok/logo_jok_big.jpg" alt="" style="border: 0px;" /></a>
</h1>
<div id="contenu">
<?
//Initialisation de la variable "qui compte les news"
$j = 1;
while($data = mysql_fetch_array($req)) ****************************************************Ligne 49*****************
{
//Affichage du titre
echo '<h2>'.$data['topic_title'].'</h2>';
//On parse la news pour y interprété le BBcode
$message = bbencode_second_pass($data['post_text'], $data['bbcode_uid']);
$message = str_replace("\n\r", "\n", $message);
$message = str_replace("\n", "<br />\n", $message);
//On s'occupe des smileys
$req_smilies = mysql_query('SELECT smilies_id, code, smile_url, emoticon FROM '.$table_prefix.'smilies'); 
$k = 0;
while($data_smilies = mysql_fetch_array($req_smilies))
{			
	$smilies[$k]['code'] = $data_smilies['code'];
	$smilies[$k]['smile_url'] = $data_smilies['smile_url'];
	$smilies[$k]['emoticon'] = $data_smilies['emoticon'];
	$k ++;
}
if (count($smilies))
{
	usort($smilies, 'smiley_sort');
}
for ($i = 0; $i < count($smilies); $i++)
{
	$orig[] = "/(?<=.\W|\W.|^\W)".phpbb_preg_quote($smilies[$i]['code'], "/")."(?=.\W|\W.|\W$)/";
	$repl[] = '<img src="'.$phpbb_root_path.'images/smiles/'.$smilies[$i]['smile_url'].'" alt="'.$smilies[$i]['emoticon'].'" />';
}
$message = preg_replace($orig, $repl, ' '.$message.' ');
$message = substr($message, 1, -1);
//Affichage du contenu de la news
echo '<p>'.$message.'</p>';
//Affichage de l'auteur
echo '<h3>Posté par <a href="'.$phpbb_root_path;
echo 'profile.php?mode=viewprofile&u='.$data['user_id'].'">'.$data['username'].'</a>';
//De l'heure
echo ' le '.date('d/m/y à H:i', $data['topic_time']).' - ';
//Des commentaires
echo '<a href="'.$phpbb_root_path.'viewtopic.php?t=';
echo $data['topic_id'].'">['.$data['topic_replies'].'] commentaire(s)</a></h3>';
//Si on atteinds 5 news, on arrete
if($j >= 5)
{
	break;
}
$j++;
mysql_free_result($req); 
}
?>
</div>
</div>
<p id="footer">
<a href="http://www.j0k3r.net" onclick="window.open(this.href);return(false);">j0k3r_n0ir</a> © 2005
</p>
</body>
</html>

Et voici le lien pour voir le resultat : http://team-declick.societeg.com/new/news.php ( je vous ai afficher la requete )

Je precise que j'ai bien 2 news dans le forum, mais juste une s'affiche.

J'ai aussi vu que ce script n'est pas tres propre, notament le coup de $j++ a la place de LIMIT, mais j'aimerais d'abord qu'il marche comme ça.

Merci d'avance

Guillaume

Archivé

Ce sujet est désormais archivé et ne peut plus recevoir de nouvelles réponses.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.