Je viens t'installer le mod rewriting ( adv_phpbb3_mod_rewriteV0-4-4 ) sur mon forum phpbb3.
Et j'ai le script ci-dessous de phpbb-seo pour afficher les 10 derniers message du forum phpbb3 sur la page d'accueil de mon site.
Nb: Le problème est que aprés l'installation du mod de rewriting ( adv_phpbb3_mod_rewriteV0-4-4 ) j'aimerai avoir accés aux url réecritent.
Par exemple : le message qui s'affiche sur la page d'accueil de mon site a une url comme: http://forums.icom7.com/viewtopic.php?t=180
et j'aimerai avoir URL rewriten : http://forums.icom7.com/google-introduc ... -t180.html
- Code: Tout sélectionner
<?php
// How Many Topics you want to display?
$topicnumber = 10;
// Scrolling towards up or down?
$urlPath = "http://forums2.icom7.com";
$exclude_forum = array (
//1 => 31,
//2 => 5,
//3 => 10,
);
define('IN_PHPBB', true);
$phpbb_root_path = 'http://forums2.icom7.com';
include('../forums2/config.php');
// Start session management
$db = new sql_db($dbhost, $dbuser, $dbpasswd, $dbname, false);
// 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 ,f.forum_name
FROM ".TOPICS_TABLE." t, ".FORUMS_TABLE." f, " . POSTS_TABLE . " p, " . USERS_TABLE . " u
WHERE t.topic_id = p.topic_id
AND f.forum_id = t.forum_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 "<div class=\"table_forum\">";
echo "<div>";
echo "";
for ($i = 0; $i < $total_topics; $i++ )
{
if ($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 "
<div class=\"groupe_forum_bande\">
<div class=\"text_forum_bande\">
<em> ".$lang['post_time']." " . date('H\hi',$last_topic_data[$i]['post_time']) . ":</em>
<a href=\"".append_sid("$urlPath/viewtopic.php?t=".$last_topic_data[$i]['topic_id'])."\">" . (utf8_encode(substr($last_topic_data[$i]['topic_title'],0,40).'...')) ."</a>
</div>
<div class=\"user_forum_bande\">
<em>by</em> <a href=\"".append_sid("$urlPath/profile.php?mode=viewprofile&u=".$last_topic_data[$i]['user_id'])."\">" . (substr($last_topic_data[$i]['username'],0,9)) . "</a>
</div>
</div>";
}
}
echo "</div></div>";
?>

Français |
Anglais
