Most bbcode gets parsed correctly, except for attachments. Attachments just show up like this:
I'm wondering how to get this to display properly with my php file. I use php and then an html page for the template. I've attached both below.
page.php
Code: Select all
<?php
/*
*
* @package phpBB3 Portal a.k.a canverPortal ( www.phpbb3portal.com )
* @version $Id: portal.php,v 1.11 2008/02/09 08:18:13 angelside Exp $
* @copyright (c) Canver Software - www.canversoft.net
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/
// Note: If you would like to have the portal in a different location than in the main phpBB3 directory
// You must change the following variable, and change the 'U_PORTAL' template variable in functions.php
define('IN_PHPBB', true);
define('IN_PORTAL', true);
define('PHPBB_ROOT_PATH', './');
define('PORTAL_ROOT_PATH','./portal/');
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './';
$portal_root_path = (defined('PORTAL_ROOT_PATH')) ? PORTAL_ROOT_PATH : './portal/';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);
include($portal_root_path . '/includes/functions.'.$phpEx);
// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup('portal');
$forum = $_GET['forum'];
$topic = $_GET['topic'];
// show login box and user menu
// acp de aç/kapa yok, dil dosyasýna ek: hiç doðumgünü yoksa evet seçili olsa bile blok görünmez.
// SQL bilgisi yok - - SQL eklenirse dil deðiþkeni de eklenmeli
//if ($config['portal_user_menu'])
//{
// only registered user see user menu
if ($user->data['is_registered'])
{
include($portal_root_path . '/block/user_menu.'.$phpEx);
}
else
{
include($portal_root_path . '/block/login_box.'.$phpEx);
}
//}
if ($config['portal_attachments'])
{
include($portal_root_path . '/block/attachments.'.$phpEx);
}
if ($config['portal_recent'])
{
include($portal_root_path . '/block/recent.'.$phpEx);
}
if ($config['portal_advanced_stat'])
{
include($portal_root_path . '/block/statistics.'.$phpEx);
}
if ($config['portal_minicalendar'])
{
include($portal_root_path . '/block/mini_cal.'.$phpEx);
}
if ($config['portal_link_us'])
{
include($portal_root_path . '/block/link_us.'.$phpEx);
}
if ($config['portal_leaders'])
{
include($portal_root_path . '/block/leaders.'.$phpEx);
}
if ($config['portal_wordgraph'])
{
include($portal_root_path . '/block/wordgraph.'.$phpEx);
}
if ( $config['portal_poll_topic'] && $config['portal_poll_topic'] != "" )
{
include($portal_root_path . '/block/poll.'.$phpEx);
}
if ($config['portal_load_last_visited_bots'])
{
include($portal_root_path . '/block/latest_bots.'.$phpEx);
}
if ($config['portal_top_posters'])
{
include($portal_root_path . '/block/top_posters.'.$phpEx);
}
if ($config['portal_latest_members'])
{
include($portal_root_path . '/block/latest_members.'.$phpEx);
}
if ($config['portal_random_member'])
{
include($portal_root_path . '/block/random_member.'.$phpEx);
}
if ($config['portal_clock'])
{
$template->assign_vars(array(
'S_DISPLAY_CLOCK' => true,
));
}
if ($config['portal_links'])
{
// include($portal_root_path . '/block/links.'.$phpEx);
$template->assign_vars(array(
'S_DISPLAY_LINKS' => true,
));
}
if ($config['portal_welcome'])
{
$template->assign_vars(array(
'S_DISPLAY_WELCOME' => true,
'PORTAL_WELCOME_INTRO' => $config['portal_welcome_intro'],
));
}
if ($config['portal_announcements'])
{
include($portal_root_path . '/block/announcements.'.$phpEx);
$template->assign_vars(array(
'S_ANNOUNCE_COMPACT' => ($config['portal_announcements_style']) ? true : false,
));
}
if ($config['portal_news'])
{
include($portal_root_path . '/block/news.'.$phpEx);
$template->assign_vars(array(
'S_NEWS_COMPACT' => ($config['portal_news_style']) ? true : false,
));
}
if ($config['portal_pay_s_block'] or $config['portal_pay_c_block'])
{
include($portal_root_path . '/block/donate.'.$phpEx);
}
if ($config['portal_ads_small'])
{
$template->assign_vars(array(
'S_ADS_SMALL' => ($config['portal_ads_small_box']) ? true : false,
'ADS_SMALL_BOX' => $config['portal_ads_small_box'],
));
}
if ($config['portal_ads_center'])
{
$template->assign_vars(array(
'S_ADS_CENTER' => ($config['portal_ads_center_box']) ? true : false,
'ADS_CENTER_BOX' => $config['portal_ads_center_box'],
));
}
// acp de aç/kapa yok - SQL bilgisi yok - SQL eklenirse dil deðiþkeni de eklenmeli
if ($user->data['is_registered']/* and $config['portal_friends']*/)
{
include($portal_root_path . '/block/friends.'.$phpEx);
}
// acp de aç/kapa yok - SQL bilgisi yok - SQL eklenirse dil deðiþkeni de eklenmeli
// dil dosyasýna ek: hiç doðumgünü yoksa evet seçili olsa bile blok görünmez.
//if ($config['show_birthdays'])
//{
include($portal_root_path . '/block/birthday_list.'.$phpEx);
//}
// acp de aç/kapa yok - SQL bilgisi yok - SQL eklenirse dil deðiþkeni de eklenmeli
//if ($config['show_whois_online'])
//{
include($portal_root_path . '/block/whois_online.'.$phpEx);
//}
// acp de aç/kapa yok - SQL bilgisi yok - SQL eklenirse dil deðiþkeni de eklenmeli
//if ($config['show_search'])
//{
include($portal_root_path . '/block/search.'.$phpEx);
//}
// acp de aç/kapa yok - SQL bilgisi yok - SQL eklenirse dil deðiþkeni de eklenmeli
//if ($config['change_style'])
//{
// include($portal_root_path . '/block/change_style.'.$phpEx); // stil seçince hata veriyor
//}
//-- Fetch the data from the specified fora
$bbcode = new bbcode();
$news_fora_id = array( $forum ); // Change in the fora id's you need
$news_topic_id = array( $topic );
$topic_count = '10'; // Change in the number of topics you want to show.
$query = "
SELECT p.topic_id, p.forum_id, p.post_time, p.post_subject, p.post_text, p.bbcode_bitfield, p.bbcode_uid, u.user_id, u.username, u.user_rank, u.user_colour, user_type, t.topic_replies, t.topic_title, t.topic_views,
(
SELECT COUNT( post_id )
FROM " . POSTS_TABLE . "
WHERE topic_id = p.topic_id
) AS aantal_posts
FROM " . POSTS_TABLE . " AS p, " . USERS_TABLE . " AS u, " . TOPICS_TABLE . " AS t
WHERE " . $db->sql_in_set( 'p.forum_id', $news_fora_id ) . " AND " . $db->sql_in_set( 't.topic_id', $news_topic_id ) . "
AND u.user_id = p.poster_id
AND t.topic_id = p.topic_id
GROUP BY topic_id
ORDER BY topic_id DESC
LIMIT 0, {$topic_count}
";
//die('<pre>' . $query );
$result = $db->sql_query( $query );
if( $row = $db->sql_fetchrow($result) )
{
// Parse the message and subject
$message = censor_text($row['post_text']);
// Second parse bbcode here
if ($row['bbcode_bitfield'])
{
$bbcode->bbcode_second_pass($message, $row['bbcode_uid'], $row['bbcode_bitfield']);
}
$message = bbcode_nl2br($message);
$message = smiley_text($message);
$userprofile = (($row['user_type'] == USER_NORMAL || $row['user_type'] == USER_FOUNDER) && $row['user_id'] != ANONYMOUS) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile&u=' . $row['user_id']) : '';
// Send data to output var
$output .= "<table class=\"tablebg\" cellspacing=\"1\" width=\"100%\">";
$output .= "<tr>";
$output .= "<td class=\"cat\"><a href=\"" . $phpbb_root_path . "viewtopic.php?f={$row['forum_id']}&t={$row['topic_id']}\" title=\"" . censor_text($row['post_subject']) . "\"><strong>".censor_text($row['post_subject'])."</strong></a></td>";
$output .= "</tr>";
$output .= "<tr class=\"row1\">";
$output .= "<td>";
$output .= "<span class=\"gensmall\" style=\"float: left;\">Poster: <strong><a href=\"" . $userprofile . "\"><b style=\"color:#" . $row[user_colour] ."\">" . $row['username'] . "</b></a></strong>";
$output .= "</span>";
$output .= "<span class=\"gensmall\" style=\"float: right;\">" . date("D M d, Y g:i a", $row['post_time']);
$output .= "</span>";
$output .= "<br />";
$output .= "<br />";
$output .= "<div class=\"postbody\">";
$output .= $message;
$output .= "<br />";
$output .= "<br />";
$output .= "</div>";
$output .= "</td>";
$output .= "</tr>";
$output .= "<tr class=\"row1\">";
$output .= "<td>";
$output .= "<span style=\"float: left;\">";
$output .= "Views: " . $row['topic_views'];
$output .= " • <a href=\"/Community/Forum/" . "viewtopic.php?f={$row['forum_id']}&t={$row['topic_id']}\" title=\"View comments\">";
$output .= "Comments: ";
$output .= $row['topic_replies'];
$output .= "</a>";
$output .= " • <a href=\"/Community/Forum/" . "posting.php?mode=reply&f={$row['forum_id']}&t={$row['topic_id']}\" title=\"" . censor_text($row['post_subject']) . "\">";
$output .= "Write comments";
$output .= "</a>";
$output .= "</span>";
$output .= "<span style=\"float: right;\">";
$output .= "<a href=\"#wrapheader\" class=\"top\" title=\"Top\">Top</a>";
$output .= "</span>";
$output .= "</td>";
$output .= "</tr>";
$output .= "</table>";
$output .= "<br />";
}
else{
$output .= "<table class=\"tablebg\" cellspacing=\"1\" width=\"100%\">";
$output .= "<tr>";
$output .= "<th>Information</th>";
$output .= "</tr>";
$output .= "<tr class=\"row1\">";
$output .= "<td>";
$output .= "<center>The requested topic does not exist.</center>";
$output .= "</td>";
$output .= "</tr>";
$output .= "</table>";
$output .= "<br />";
}
$template->assign_vars(array(
'S_DISPLAY_JUMPBOX' => true, // SQL + ACP eklenecek
'PORTAL_LEFT_COLLUMN' => $config['portal_left_collumn_width'],
'PORTAL_RIGHT_COLLUMN' => $config['portal_right_collumn_width'],
'OUTPUT' => $output,
));
// output page
page_header($user->lang['PORTAL']);
//page_header($config['sitename']);
$template->set_filenames(array(
'body' => 'portal/page_body.html'
));
// SQL + ACP eklenecek
make_jumpbox(append_sid("{$phpbb_root_path}viewforum.$phpEx"));
page_footer();
?>
Code: Select all
<!-- INCLUDE portal/leftblockarea.html -->
<!-- [+] center block area -->
<td valign="top">
<!-- IF S_USER_LOGGED_IN -->
{OUTPUT}
<!-- ENDIF -->
<!-- IF S_DISPLAY_WORDGRAPH -->
<!-- INCLUDE portal/block/wordgraph.html -->
<!-- ENDIF -->
<!-- IF S_DISPLAY_JUMPBOX -->
<!-- INCLUDE portal/block/jumpbox.html -->
<!-- ENDIF -->
</td>
<!-- [-] center block area -->
<!-- INCLUDE portal/rightblockarea.html -->
Thanks for any help
