Modérateur: Modérateurs

SeO a écrit:Extra :GYM sitemaps & RSS inclus un générateur de liens alternate et html (par défaut dans le footer) facilement utilisable dans vos templates.
Le mod inclus également un système permettant l'affichage de flux RSS 2.0 sur n'importe quelle page de votre forum.
Exemple :

$link = mysql_connect ($dbhost,$dbuser,$dbpasswd) or die ('Erreur : '.mysql_error() );
mysql_select_db($dbname);
$select = "SELECT topic_title,topic_id,topic_poster,forum_id,topic_first_poster_name,topic_time FROM {$table_prefix}topics where forum_id !='9' and forum_id !='19' ORDER BY topic_id DESC LIMIT 10";
$result = mysql_query($select,$link);
while($row = mysql_fetch_array($result))
{
$topic_id = $row['topic_id'];
$titre = utf8_encode($row['topic_title']);
$posteur = utf8_encode($row['topic_first_poster_name']);
setlocale(LC_TIME, "fr_FR");
$date = utf8_encode(strftime("%A %e %B à %H:%M", $row['topic_time']+(0)));
$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, '-'));
echo "<a href=\"/forum/".$annonce."-t".$topic_id.".html\">".$titre."</a> par ".$posteur." (<em>".$date."</em>)<br />";
}
mysql_close();
[phpBB Debug] PHP Notice: in file /includes/session.php on line 942: Cannot modify header information - headers already sent by (output started at /home/fx/www/menu.php:5)
[phpBB Debug] PHP Notice: in file /includes/session.php on line 942: Cannot modify header information - headers already sent by (output started at /home/fx/www/menu.php:5)
[phpBB Debug] PHP Notice: in file /includes/session.php on line 942: Cannot modify header information - headers already sent by (output started at /home/fx/www/menu.php:5)
<?php
define('IN_PHPBB', TRUE);
$phpbb_root_path = 'forum/';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);
// Start session management
$user->session_begin();
$user->setup('');
$sql = 'SELECT p.*, t.*, u.user_id, u.username FROM ' . POSTS_TABLE . ' p JOIN ' . TOPICS_TABLE . ' t JOIN ' . USERS_TABLE . ' u
ON p.topic_id = t.topic_id
AND u.user_id = p.poster_id
ORDER BY p.post_id DESC LIMIT 12';
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
{
echo 'Sujet: <a href="'.append_sid($phpbb_root_path . 'viewtopic.php?t=' . $row['topic_id']).'" target="_blank" >' . $row['topic_title'] . "</a><br />";
}
?>


$user->setup(); $user->setup(''); 
SeO a écrit:as tu essayer, au lieu de l'inclure, de mettre le code php directement dans le fichier qui l'utilise ?


$fichierRss = 'http://www.wimeo.fr/forum/rss/rss.xml.gz';
$xml = simplexml_load_file($fichierRss);
foreach($xml->channel->item as $infos) {
$timestamp = strtotime($infos->pubDate);
$date = date('j/m/Y à G:i', $timestamp);
preg_match('`<span(.*)span>`Usi', $infos->description, $sortie);
$pseudo = $sortie[0];
echo '<li><a href="' ,$infos->link.'">' ,$infos->title.'</a> posté le ' , $date ,' Par '.$pseudo.'</li>';
}
Retourner vers Développement de site
Utilisateurs parcourant ce forum: coconutccg et 5 invités