Je souhaite ajouter sur mon site la liste des messages (uniquement les liens vers les messages).
J'utilise le code de ce topic de la manière suivante :
- Code: Tout sélectionner
<ul>
<?php
define('IN_SITE', true);
define('IN_PHPBB', true);
$phpbb_root_path = 'forum/';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);
// Sélection des 10 derniers posts
$sql = "SELECT topic_replies_real,topic_replies,topic_title,forum_id,topic_id,topic_type,topic_last_post_id
FROM phpbb_topics
WHERE topic_approved = 1
ORDER BY topic_last_post_time DESC
LIMIT 10";
$result = $db->sql_query($sql);
// Boucle d'affichage du post
while($db_data = mysql_fetch_assoc($req)) {
// Données du topic
$topic_title = $topic_data['topic_title'];
$forum_id = $topic_data['forum_id'];
$topic_id = $topic_data['topic_id'];
// Url du post
// www.phpBB-SEO.com SEO TOOLKIT BEGIN
$topic_data['topic_title'] = censor_text($topic_data['topic_title']);
if (empty($phpbb_seo->seo_opt['virtual_folder'] || !empty($phpbb_seo->seo_url['forum'][$forum_id]) || $topic_data['topic_type'] == POST_GLOBAL)
{
$phpbb_seo->prepare_iurl($topic_data, 'topic', $topic_data['topic_type'] == POST_GLOBAL ? $phpbb_seo->seo_static['global_announce'] :
$phpbb_seo->seo_url['forum'][$forum_id]);
}
// www.phpBB-SEO.com SEO TOOLKIT END
$post_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id");
//On affiche
echo '<li><a href="'.$post_url.'">'.$topic_title.'</a></li>';
}
$db->sql_freeresult($result);
?>
</ul>
Cela ne fonctionne pas, le message d'erreur est :
PHP Parse error: syntax error, unexpected T_BOOLEAN_OR, expecting ')'
La ligne en erreur est
if (empty($phpbb_seo->seo_opt['virtual_folder'] || !empty($phpbb_seo->seo_url['forum'][$forum_id]) || $topic_data['topic_type'] == POST_GLOBAL)
Auriez-vous une idée ?
Aussi,l’url de ce code affiche : http://www.nomdedomaine.com/forum/topic.htm
Comment modifier ce code pour que l’url s’affiche de cette manière :
http://www.nomdedomaine.com/forum/nomduforum/topic-t1.htm
D’avance merci
Michaël

Français |
Anglais

