Applying feed from certain topics on to a different webpage making all of my other PHP code display invisible

Discussion forum for MOD Writers regarding MOD Development.
Locked
tomtuck93
Registered User
Posts: 2
Joined: Tue May 26, 2015 11:20 pm

Applying feed from certain topics on to a different webpage making all of my other PHP code display invisible

Post by tomtuck93 »

Hello, I've done a lot of re-search on my issue but haven't come across anything similar so I was wondering if anyone could shed a little light on the matter. I'm running Phpbb3 Version: 3.0.12. I'm trying to get all the topics from my "NEWS" Category posted on to the index.php of my Website. With the code I'm using I can get this working perfectly fine, in it's own .php file. But as soon as I add it into my index.php all of the PHP code below the forum code doesn't show. For example my layout is > Header > Login Function > Blank Space in the middle (Using this for the forum code) > 2 other PHP Scripts. As soon as I apply the forum code the 2 other PHP scripts and their markups completely dissapear from my website. The only way I can prevent this is by putting the Forum code at the bottom of my index.php but then it displays on the far left and I want it in the middle. I have tried putting it in it's own file and doing

Code: Select all

<?php include_once('external_page.php'); ?>
but the same problem persists. Here is my forum code;

Code: Select all

<?php
/*
* home.php
* Description: example file for displaying latest posts and topics
* by battye (for phpBB.com MOD Team)
* September 29, 2009
*/


define('IN_PHPBB', true);
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './forum/';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);
include($phpbb_root_path . 'includes/bbcode.php');
include($phpbb_root_path . 'includes/functions_display.php');

// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup('viewforum');

$search_limit = 7;

$posts_ary = array(
'SELECT' => 'p.*, t.*, u.username, u.user_colour',

'FROM' => array(
POSTS_TABLE => 'p',
),

'LEFT_JOIN' => array(
array(
'FROM' => array(USERS_TABLE => 'u'),
'ON' => 'u.user_id = p.poster_id'
),
array(
'FROM' => array(TOPICS_TABLE => 't'),
'ON' => 'p.topic_id = t.topic_id'
),
),

'WHERE' => '
t.topic_status <> ' . ITEM_MOVED . '
AND t.topic_approved = 1',

'ORDER_BY' => 'p.post_id DESC',
);

$posts = $db->sql_build_query('SELECT', $posts_ary);

$posts_result = $db->sql_query_limit($posts, $search_limit);

while( $posts_row = $db->sql_fetchrow($posts_result) )
{
$topic_title = $posts_row['topic_title'];
$post_author = get_username_string('full', $posts_row['poster_id'], $posts_row['username'], $posts_row['user_colour']);
$post_date = $user->format_date($posts_row['post_time']);
$post_link = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "p=" . $posts_row['post_id'] . "#p" . $posts_row['post_id']);

$post_text = nl2br($posts_row['post_text']);

$bbcode = new bbcode(base64_encode($bbcode_bitfield));
$bbcode->bbcode_second_pass($post_text, $posts_row['bbcode_uid'], $posts_row['bbcode_bitfield']);

$post_text = smiley_text($post_text);

$template->assign_block_vars('announcements', array(
'TOPIC_TITLE' => censor_text($topic_title),
'POST_AUTHOR' => $post_author,
'POST_DATE' => $post_date,
'POST_LINK' => $post_link,
'POST_TEXT' => censor_text($post_text),
));
}

page_header('External page');

$template->set_filenames(array(
'body' => 'external_body.html'
));

page_footer();
?>
Thank you in advance, regards. Tom.
Locked

Return to “[3.0.x] MOD Writers Discussion”