Bonsoir,
Tu ne peux pas mettre cela dans un bloc HTML, sauf si tu acceptes le php dedans via l'administration.
Va dans l'administration, dans
Paramètres de sécurité, coche
oui à php dans les templates.
Ensuite, ton code, tu dois le mettre entre ces balises:
- Code: Tout sélectionner
<!-- PHP --> <!-- ENDPHP -->
Cela donne:
- Code: Tout sélectionner
<!-- PHP -->
define('IN_PHPBB', TRUE);
$phpbb_root_path = '';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);
$sql = 'SELECT p.*, t.* FROM ' . POSTS_TABLE . ' p JOIN ' . TOPICS_TABLE . ' t ON p.topic_id = t.topic_id ORDER BY p.post_id DESC LIMIT 10';
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
{
echo '<a href="' . $phpbb_root_path . 'viewtopic.php?t=' . $row['topic_id'] . '">' . utf8_decode($row['topic_title']) . '</a>:<br />';
echo utf8_decode($row['post_text']) .'...<br /><br />';
}
<!-- ENDPHP -->
A tester bien entendu et n'oublie pas de vider le cache et de rafraîchir les templates.
Toutefois, il est possible que cela gêne:
- Code: Tout sélectionner
define('IN_PHPBB', TRUE);
$phpbb_root_path = '';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);
A bientôt,