I've found this script, which allows me to get several last posts in the custom pages:
- Code: Select all
<?php
/**
* newest_posts - raw dump of newest posts from forum
*
* @copyright (c) 2008 ameeck / Vojtech Vondra - phpBB.cz
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*/
define('IN_PHPBB', true);
$phpbb_root_path = './';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);
// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup();
// Number of posts and grabbing permissions
// Počet příspěvků pro zobrazení a oprávnění
$topic_limit = request_var('topic_limit', 5);
$forums = array_unique(array_keys($auth->acl_getf('f_read', true)));
// Select the last topics to which we have permissions
// Vybrat poslední témata ke kterým máme oprávnění
$sql = 'SELECT p.post_id, p.topic_id, p.forum_id, p.post_subject, p.post_time, u.username
FROM ' . POSTS_TABLE . ' p , ' . USERS_TABLE . ' u
WHERE post_approved = 1
AND ' . $db->sql_in_set('forum_id', $forums) . '
AND u.user_id = p.poster_id
ORDER BY post_time DESC
LIMIT 0,' . $topic_limit;
$result = $db->sql_query($sql);
// Proper header since output not buffered
// Poslat hlavičky pro správné kódování, protože výpis obsahu je postupný
header('Content-Type: text/html; charset=utf-8');
// Now let's output the content
// A teď vypsat obsah
echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Poslední příspěvky z fóra</title></head><body><div id="post_content"><strong>Novinky z fora:</strong><br/><ul>';
while ($row = $db->sql_fetchrow($result))
{
$url = generate_board_url() . "/viewtopic.{$phpEx}?f={$row['forum_id']}&t={$row['topic_id']}&p={$row['post_id']}#p{$row['post_id']}";
echo '<li><a target="_top" href="' . $url . '">' . $row['post_subject'] . '</a> od ' . $row['username'] . ' v ' . $user->format_date($row['post_time']) . '</li>';
}
echo '</ul></div></body></html>';
?>
But there's a rub. It doesn't rewrite the URLs ...
Is there any way to do that?
Beside I'm using phpBB 3.0.1. - Advanced phpBB3 SEO mod Rewrite.
Thanks in advance

English |
French
