je fais appel a vous car j'ai un petit souci que je n'arrive pas a resoudre.
sur la page web du site, j'essai d'afficher les derniers post du forum ( situé dans /forum/). jusqu'a la, je pense mettre pas trop mal debrouillé grace a ce forum.
cependant, j'ai parfois cette erreur:
Warning: Cannot modify header information - headers already sent by (output started at c:\easyphp17\www\planete-pocket\index.php:10) in c:\easyphp17\www\planete-pocket\forum\includes\sessions.php on line 256
Warning: Cannot modify header information - headers already sent by (output started at c:\easyphp17\www\planete-pocket\index.php:10) in c:\easyphp17\www\planete-pocket\forum\includes\sessions.php on line 257
si je dit parfois, c'est tout simplement parsque cette erreur apparait tant que je ne suis pas allé sur le forum....une fois le forum visité, cette erreur disparait....porqué???
voici mon code:
- Code: Tout sélectionner
<p><span class="subHeader">Les dérniers posts du forum</span><br />
<?php
// Last XX Active Topics outside phpBB - dcz - www.phpBB-SEO.com
// License: http://opensource.org/licenses/gpl-license.php GNU General Public License v2
//
// Basic Configuration
// How Many Topics you want to display?
$topicnumber = 10;
// Scrolling towards up or down?
$scroll = "up";
// Change this to your phpBB URL
$urlPath = "http://127.0.0.1/planete-pocket/forum";
// Change this to your phpBB path
$phpbb_root_path = 'forum/';
// Exclude forums, forum id in this array will not be listed
$exclude_forum = array (
//1 => 31,
//2 => 5,
//3 => 10,
);
define('IN_PHPBB', true);
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);
// Start session management
$userdata = session_pagestart($user_ip, PAGE_INDEX);
init_userprefs($userdata);
// End session management
// Let's do it now
$sql = "SELECT t.topic_poster,t.topic_views,t.topic_replies,t.topic_id, t.topic_title, t.topic_last_post_id, t.forum_id, p.post_id, p.poster_id, p.post_time, u.user_id, u.username
FROM ".TOPICS_TABLE." t, " . POSTS_TABLE . " p, " . USERS_TABLE . " u
WHERE t.topic_id = p.topic_id
AND t.topic_status <> 2
AND p.post_id = t.topic_last_post_id
AND p.poster_id = u.user_id
ORDER BY p.post_id DESC LIMIT $topicnumber";
//Begin sql cache
if ( !($result = $db->sql_query($sql)) )
//if ( !($result = $db->sql_query($sql, false, 'posts_')) )
//End sql cache
{
message_die(GENERAL_ERROR, 'Could not obtain Last topics info', '', __LINE__, __FILE__, $sql);
}
$last_topic_data = array();
while( $row = $db->sql_fetchrow($result) )
{
$last_topic_data[] = $row;
}
$db->sql_freeresult($result);
unset($row);
// Handle the not topics case, if you want
if ( !($total_topics = count($last_topic_data)) )
{
$message = 'Something you want to say here ';
message_die(GENERAL_MESSAGE, $message);
}
//
// Find which forums are visible for this user
//
$is_auth_ary = array();
$is_auth_ary = auth(AUTH_VIEW, AUTH_LIST_ALL, $userdata, $last_topic_data);
// here I keep the basic html output
// Outcome of the HTML
// Be carefull when you edit these!
// echo "<marquee dir=\"rtl\" align=\"center\" id=\"recent_topics\" behavior=\"scroll\" direction=\"$scroll\" height=\"150\" width=\"100%\" scrolldelay=\"100\" scrollamount=\"2\" onMouseOver=\"stop()\" onMouseOut=\"start()\">";
echo "<div align=\"left\">";
echo "<table cellpadding='3' cellSpacing='2'";
for ($i = 0; $i < $total_topics; $i++ )
{
if (($userdata['user_level'] == ADMIN) || $is_auth_ary[$last_topic_data[$i]['forum_id']]['auth_view'] && !in_array($last_topic_data[$i]['forum_id'], $exclude_forum))
{
// phpBB-SEO.com SEO TOOLKIT BEGIN
$seo_forum_name = $last_topic_data[$i]['forum_name'];
$seo_topic_name = $last_topic_data[$i]['topic_title'];
// phpBB-SEO.com SEO TOOLKIT END
echo "<tr valign='top'>
<td><span class=\"nav\">".$lang['Last_Post']." :
<a href=\"".append_sid("$urlPath/viewtopic.php?t=".$last_topic_data[$i]['topic_id'])."\" class=\"nav\">" . $last_topic_data[$i]['topic_title'] ."</span></a></td>
<td><span class=\"nav\"> ".$lang['Views']." : " . $row['topic_views'] . "</span></td>
<td><span class=\"nav\"> ".$lang['Replies']." : " . $last_topic_data[$i]['topic_replies'] . "</span></a></td>
<td><span class=\"nav\"> ".$lang['Poster']." :
<a href=\"".append_sid("$urlPath/profile.php?mode=viewprofile&u=".$last_topic_data[$i]['user_id'])."\" class=\"nav\" >" . $last_topic_data[$i]['username'] . "</a></td></tr>";
}
}
echo "</table></div></marquee>";
?>
</p>
Merci pour votre aide
edit: je cherche aussi a ne pas afficher les messages des admin qui ce trouve dans les zone privé.
j'ai bien:
- Code: Tout sélectionner
if (($userdata['user_level'] == ADMIN) || $is_auth_ary[$last_topic_data[$i]['forum_id']]['auth_view'] && !in_array($last_topic_data[$i]['forum_id'], $exclude_forum))
mais ca ne fonctionne pas...

Français |
Anglais
