Das Problem ist, dass er mir die Datensätze nicht anzeigt.
Es kommt aber auch keine Fehlermeldung bei der DB Abfragen.
Code: Alles auswählen
define('IN_PHPBB', true);
$phpbb_root_path = './';
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);
include($phpbb_root_path . 'includes/bbcode.'.$phpEx);
include($phpbb_root_path . 'includes/functions_post.'.$phpEx);
// Number of NEWS
$number_of_news ='10';
// Read NEWS Configuration from DB
define('NEWS', $table_prefix.'news');
define('NEWS_COMMENT', $table_prefix.'news_comment');
//
// Start session management
//
$userdata = session_pagestart($user_ip, PAGE_INDEX);
init_userprefs($userdata);
//
// End session management
//
// Start output of page
$template->set_filenames(array('body' => 'news_body.tpl'));
$page_title = $lang['News_portal'];
include($phpbb_root_path . 'includes/page_header.'.$phpEx);
function phpbb_fetch_news($number_of_news)
{
global $db, $board_config;
$sql = 'SELECT
news_id,
news_title,
news_user_id,
news_username,
news_user_ip,
news_user_email,
news_time,
news_view_count
FROM
' . NEWS . '
ORDER BY
news_time';
if ($number_of_news != 0)
{
$sql .= ' LIMIT ' . $number_of_news;
}
if(!($result = $db->sql_query($sql)))
{
message_die(GENERAL_ERROR, 'Could not query news information', '', __LINE__, __FILE__, $sql);
}
$news = array();
if ($row = $db->sql_fetchrow($result))
{
$i = 0;
do
{
$news[$i]['news_id'] = $row['news_uid'];
$news[$i]['news_title'] = $row['news_title'];
$news[$i]['news_user_id'] = $row['news_user_id'];
$news[$i]['news_username'] = $row['news_username'];
$news[$i]['news_user_ip'] = $row['news_user_ip'];
$news[$i]['news_user_email'] = $row['news_user_email'];
$news[$i]['news_time'] = create_date($board_config['default_dateformat'], $row['news_time'], $board_config['board_timezone']);
$news[$i]['news_view_count'] = $row['news_view_count'];
$i++;
}
while ($row = $db->sql_fetchrow($result));
}
return $news;
}
$fetchnews = phpbb_fetch_news($number_of_news);
for ($i = 0; $i < count($fetchnews); $i++)
{
$template->assign_block_vars('news', array(
'ID' => $fetchnews[$i]['news_id'],
'TITLE' => $fetchnews[$i]['news_title'],
'POSTER' => $fetchnews[$i]['news_username'],
'TIME' => $fetchnews[$i]['news_time'],
)
);
}
// Generate the page
$template->pparse('body');
include($phpbb_root_path . 'includes/page_tail.'.$phpEx);