Problem with Displaying Topics/Posts on external page #9001

All web design discussion, including Ultimate Quiz MOD support.

Moderator: CricketMX Forum Moderators

User avatar
TheGiftedApe
Greenhorn
Greenhorn
Posts: 16
Joined: Mon Nov 07, 2011 5:41 am

Let me start off with thx battye for writing up the how-to: http://wiki.phpbb.com/Displaying_posts_ ... ied_topics
I tried to read through as many of the posts on the subject as I could but I did not find a solution, hopefully you can help.

Now I'm trying to display the most recent posts from a certain "news" section on the frontpage of my site like blog posts. I can get it to work fine if I use your "example 4" and the script download you provided i just copy paste and it fires right up. However I am trying to only display posts from the "news" section and not just general blabber. When I try to add in the code from example#3 I get an error.

The problem seems to lie here:

Code: Select all

'WHERE'     =>  str_replace( array('WHERE ', 'topic_id'), array('', 't.topic_id'), $topic_id_where) . '
                        AND t.topic_status <> ' . ITEM_MOVED . '
                         AND t.topic_approved = 1',
Which seems to be the only thing that differentiates example#3 from #4. My Question is, How do I define the place where It pulls the posts from!?? Say I have 3 forums on my site, General discussion area, Hidden for members only section, and the "News Posts" section, how do I tell it to only pull posts from "News Posts"????

as a secondary question, Which part of the code would I place in my <div> so it actually displays it on my newspage, which parts go where? header,body,etc. Can I just use a php include code to pull home.php into my main index.php site so it will display whatever is on home.php in the news section of my main page?

Thanks for any help, much appreciated, cool site I think i'll stick around either way, found some solutions to other problems ive been searching for already. :) I am a php newb, but I am good with photoshop&html :)
User avatar
battye
Site Admin
Site Admin
Posts: 14391
Joined: Sun Jan 11, 2004 8:26 am
Location: Australia
Contact:

Hi TheGiftedApe, welcome to CMX :)
If you see this section: http://wiki.phpbb.com/Displaying_posts_ ... nformation

Where you define the forums you want to pull from is:

Code: Select all

$forum_id = array(2, 5); 
So if your "News Posts" forum was id 2, then it would just be $forum_id = array(2);
as a secondary question, Which part of the code would I place in my <div> so it actually displays it on my newspage, which parts go where? header,body,etc. Can I just use a php include code to pull home.php into my main index.php site so it will display whatever is on home.php in the news section of my main page?
I take it from this part that your main website is separate to the forum? ie. different appearance
The templating code is only useful if the main website is fully integrated with phpBB3. Otherwise you will need to use a series of echo statements to output the latest post information. There is quite a bit of information on how to do this HTML implementation at http://forums.cricketmx.com/viewtopic.p ... 36#p106836 :)

Let me know if misunderstood that part of your question :)
CricketMX.com in 2022: Still the home of bat's, rat's and other farmyard animals!

"OK, life [as you chose to define it] repeats until there are no more lessons to be learned." - nrnoble (June 12, 2005)
"the new forum looks awesome, it's getting bigger & better" - p2p-sharing-rules (11 Jan, 2008)
"Looks like CMX is not only getting bigger...but, also getting better!!" - moongirl (14 Dec, 2007)
User avatar
TheGiftedApe
Greenhorn
Greenhorn
Posts: 16
Joined: Mon Nov 07, 2011 5:41 am

you sir are a god among meer mortals

And Yes the regular website is not integrated with phpbb3, its just a regular static style css website. This however shall make it much more interesting! Thx for posting all the help. My mind was totally blown on how to id the forums lol.
User avatar
TheGiftedApe
Greenhorn
Greenhorn
Posts: 16
Joined: Mon Nov 07, 2011 5:41 am

ok so i ran into a new problem.

I got it to now display with the example#3 script, problem is it only displays 3 posts, no matter what I change. And It pulls the posts from completely random places. 2 of the posts are from months ago from the same thread, and the 3rd post is actually one of the posts I made in the news section to test to see if it works.

Here is the code i'm using:

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 : './';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);
include($phpbb_root_path . 'includes/bbcode.' . $phpEx);
include($phpbb_root_path . 'includes/functions_display.' . $phpEx);

/* create_where_clauses( int[] gen_id, String type )
* This function outputs an SQL WHERE statement for use when grabbing 
* posts and topics */

function create_where_clauses($gen_id, $type)
{
global $db, $auth;

    $size_gen_id = sizeof($gen_id);

        switch($type)
        {
            case 'forum':
                $type = 'forum_id';
                break;
            case 'topic':
                $type = 'topic_id';
                break;
            default:
                trigger_error('No type defined');
        }

    // Set $out_where to nothing, this will be used of the gen_id
    // size is empty, in other words "grab from anywhere" with
    // no restrictions
    $out_where = '';

    if( $size_gen_id > 0 )
    {
    // Get a list of all forums the user has permissions to read
    $auth_f_read = array_keys($auth->acl_getf('f_read', true));

        if( $type == 'topic_id' )
        {
            $sql     = 'SELECT topic_id FROM ' . TOPICS_TABLE . '
                        WHERE ' .  $db->sql_in_set('topic_id', $gen_id) . '
                        AND ' .  $db->sql_in_set('forum_id', $auth_f_read);

            $result     = $db->sql_query($sql);

                while( $row = $db->sql_fetchrow($result) )
                {
                        // Create an array with all acceptable topic ids
                        $topic_id_list[] = $row['topic_id'];
                }

            unset($gen_id);

            $gen_id = $topic_id_list;
            $size_gen_id = sizeof($gen_id);
        }

    $j = 0;    

        for( $i = 0; $i < $size_gen_id; $i++ )
        {
        $id_check = (int) $gen_id[$i];

            // If the type is topic, all checks have been made and the query can start to be built
            if( $type == 'topic_id' )
            {
                $out_where .= ($j == 0) ? 'WHERE ' . $type . ' = ' . $id_check . ' ' : 'OR ' . $type . ' = ' . $id_check . ' ';
            }

            // If the type is forum, do the check to make sure the user has read permissions
            else if( $type == 'forum_id' && $auth->acl_get('f_read', $id_check) )
            {
                $out_where .= ($j == 0) ? 'WHERE ' . $type . ' = ' . $id_check . ' ' : 'OR ' . $type . ' = ' . $id_check . ' ';
            }    

        $j++;
        }
    }

    if( $out_where == '' && $size_gen_id > 0 )
    {
        trigger_error('A list of topics/forums has not been created');
    }

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

$search_limit = 8;

    $forum_id = array(1);
    $forum_id_where = create_where_clauses($forum_id, 'forum');

    $topic_id = array(20, 50);
    $topic_id_where = create_where_clauses($topic_id, 'topic');
$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'     =>  str_replace( array('WHERE ', 'topic_id'), array('', 't.topic_id'), $topic_id_where) . '
                        AND 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();
?>

I've tried changing this part:

Code: Select all

$search_limit = 8;

    $forum_id = array(1);
    $forum_id_where = create_where_clauses($forum_id, 'forum');

    $topic_id = array(20, 50);
    $topic_id_where = create_where_clauses($topic_id, 'topic');
to $search_limit = 5; 6 7 8 etc, but it always only displays the same 3 posts, two of the posts are from the same random thread.

Also when I change: $forum_id = array(1); to $forum_id = array(2); or 3, It still displays the same results. But hey atleast its not a big fat Error message right? Any ideas where I screwed up. I want it to display the most recent 6-7 topics from the "News Section" only, not the first 6-7 posts in the forum if that makes any difference. Thanks for any help/ideas

This is what my forums look like from the admin control panel:
Image

Link to where I am testing this: http://thegiftedape.com/xo/tester.php
Forum Link: http://thegiftedape.com/xo/
User avatar
battye
Site Admin
Site Admin
Posts: 14391
Joined: Sun Jan 11, 2004 8:26 am
Location: Australia
Contact:

Sorry, I should have picked this up in your original post. Example 3 is "Display posts from specified topics", in your code above you'll see that you have $topic_id = array(20, 50); so I'm betting the 3 posts you are seeing are from those topics.
I want it to display the most recent 6-7 topics from the "News Section" only, not the first 6-7 posts in the forum if that makes any difference. Thanks for any help/ideas
Do you mean like on my homepage here? www.cricketmx.com
That takes the first post of the topic from the last couple of topics posted in the Updates forum. If that's the sort of thing you want then you will need to use Example 2 "Display first post from the last five topics", and put the correct forum id settings as outlined above :) Then try setting $search_limit = 5; and hopefully it will work.

Don't worry, we will eventually get this working - even if it requires a little bit of tweaking the customise it for your desired output :)
CricketMX.com in 2022: Still the home of bat's, rat's and other farmyard animals!

"OK, life [as you chose to define it] repeats until there are no more lessons to be learned." - nrnoble (June 12, 2005)
"the new forum looks awesome, it's getting bigger & better" - p2p-sharing-rules (11 Jan, 2008)
"Looks like CMX is not only getting bigger...but, also getting better!!" - moongirl (14 Dec, 2007)
User avatar
TheGiftedApe
Greenhorn
Greenhorn
Posts: 16
Joined: Mon Nov 07, 2011 5:41 am

battye wrote:Sorry, I should have picked this up in your original post. Example 3 is "Display posts from specified topics", in your code above you'll see that you have $topic_id = array(20, 50); so I'm betting the 3 posts you are seeing are from those topics.
I want it to display the most recent 6-7 topics from the "News Section" only, not the first 6-7 posts in the forum if that makes any difference. Thanks for any help/ideas
Do you mean like on my homepage here? http://www.cricketmx.com
That takes the first post of the topic from the last couple of topics posted in the Updates forum. If that's the sort of thing you want then you will need to use Example 2 "Display first post from the last five topics", and put the correct forum id settings as outlined above :) Then try setting $search_limit = 5; and hopefully it will work.

Don't worry, we will eventually get this working - even if it requires a little bit of tweaking the customise it for your desired output :)

LOL now i feel like an idiot. Thanks so much for getting back to me I will try this tonight when I am done with work!!! And yes I want it exactly like how your web site is :). Will be so nice when I can have html-illiterate members of my site being able to post their own news.
User avatar
TheGiftedApe
Greenhorn
Greenhorn
Posts: 16
Joined: Mon Nov 07, 2011 5:41 am

A HA!!!!! http://thegiftedape.com/xo/forum/tester.php I got it too work battye you are a true genius!

ok so my next step, How to set up the CSS for it, do i need to edit the external_body file or where would I place the css to make it look a little better. Or will it use the same css as the page I place it on if I use your technique of using "echo" to place it within a different .php file. I'd like it too look like similar to cricketmx.com's homepage with the links clickable to the forum, and looking shiny.(usernames/comments etc) Also something that worries me is that I have to put the external_body file in the Prosilver theme folder but i don't use prosilver I use a custom theme for my forum, will that cause me issues down the line or will it not matter?

By the way It might be common knowledge but you might want to add to your how-to, how to find the Forum_id #, Took me a little while to figure out when your viewing the forum that the f=## in the url is the forum_id number.

once again thx for any help, very much appreciated. :D Btw this experience has motivated me to take an introductory php/javascripting class next semester at school im very excited, should be a few hundred dollars well spent.

edit: It does not seem to be posting the author name, date, or post link: http://thegiftedape.com/xo/forum/tester.php just a blank line instead of the authors name, don't know what might be causing that, heres my 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 : './';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);
include($phpbb_root_path . 'includes/bbcode.' . $phpEx);
include($phpbb_root_path . 'includes/functions_display.' . $phpEx);

// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup('viewforum');
/* create_where_clauses( int[] gen_id, String type )
* This function outputs an SQL WHERE statement for use when grabbing 
* posts and topics */

function create_where_clauses($gen_id, $type)
{
global $db, $auth;

    $size_gen_id = sizeof($gen_id);

        switch($type)
        {
            case 'forum':
                $type = 'forum_id';
                break;
            case 'topic':
                $type = 'topic_id';
                break;
            default:
                trigger_error('No type defined');
        }

    // Set $out_where to nothing, this will be used of the gen_id
    // size is empty, in other words "grab from anywhere" with
    // no restrictions
    $out_where = '';

    if( $size_gen_id > 0 )
    {
    // Get a list of all forums the user has permissions to read
    $auth_f_read = array_keys($auth->acl_getf('f_read', true));

        if( $type == 'topic_id' )
        {
            $sql     = 'SELECT topic_id FROM ' . TOPICS_TABLE . '
                        WHERE ' .  $db->sql_in_set('topic_id', $gen_id) . '
                        AND ' .  $db->sql_in_set('forum_id', $auth_f_read);

            $result     = $db->sql_query($sql);

                while( $row = $db->sql_fetchrow($result) )
                {
                        // Create an array with all acceptable topic ids
                        $topic_id_list[] = $row['topic_id'];
                }

            unset($gen_id);

            $gen_id = $topic_id_list;
            $size_gen_id = sizeof($gen_id);
        }

    $j = 0;    

        for( $i = 0; $i < $size_gen_id; $i++ )
        {
        $id_check = (int) $gen_id[$i];

            // If the type is topic, all checks have been made and the query can start to be built
            if( $type == 'topic_id' )
            {
                $out_where .= ($j == 0) ? 'WHERE ' . $type . ' = ' . $id_check . ' ' : 'OR ' . $type . ' = ' . $id_check . ' ';
            }

            // If the type is forum, do the check to make sure the user has read permissions
            else if( $type == 'forum_id' && $auth->acl_get('f_read', $id_check) )
            {
                $out_where .= ($j == 0) ? 'WHERE ' . $type . ' = ' . $id_check . ' ' : 'OR ' . $type . ' = ' . $id_check . ' ';
            }    

        $j++;
        }
    }

    if( $out_where == '' && $size_gen_id > 0 )
    {
        trigger_error('A list of topics/forums has not been created');
    }

    return $out_where;
}

$search_limit = 5;

    $forum_id = array(17);
    $forum_id_where = create_where_clauses($forum_id, 'forum');

    $topic_id = array();
    $topic_id_where = create_where_clauses($topic_id, 'topic');
$posts_ary = array(
        'SELECT'    => 'p.*, t.*',
    
        'FROM'      => array(
            POSTS_TABLE     => 'p',
        ),
    
        'LEFT_JOIN' => array(
            array(
                'FROM'  => array(TOPICS_TABLE => 't'),
                'ON'    => 't.topic_first_post_id = p.post_id'
            )
        ),
    
        'WHERE'     => str_replace( array('WHERE ', 'forum_id'), array('', 't.forum_id'), $forum_id_where) . '
                        AND 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'];
         $topic_author       = get_username_string('full', $posts_row['topic_poster'], $posts_row['topic_first_poster_name'], $posts_row['topic_first_poster_colour']);
         $topic_date       = $user->format_date($posts_row['topic_time']);
         $topic_link       = append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $posts_row['forum_id'] . '&t=' . $posts_row['topic_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),
         'TOPIC_AUTHOR'       => $topic_author,
         'TOPIC_DATE'       => $topic_date,
         'TOPIC_LINK'       => $topic_link,
         'POST_TEXT'         => censor_text($post_text),
         ));
      }

page_header('External page');

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

    page_footer();
?>
User avatar
battye
Site Admin
Site Admin
Posts: 14391
Joined: Sun Jan 11, 2004 8:26 am
Location: Australia
Contact:

Can you please post the contents of your external_body.html file?
CricketMX.com in 2022: Still the home of bat's, rat's and other farmyard animals!

"OK, life [as you chose to define it] repeats until there are no more lessons to be learned." - nrnoble (June 12, 2005)
"the new forum looks awesome, it's getting bigger & better" - p2p-sharing-rules (11 Jan, 2008)
"Looks like CMX is not only getting bigger...but, also getting better!!" - moongirl (14 Dec, 2007)
User avatar
TheGiftedApe
Greenhorn
Greenhorn
Posts: 16
Joined: Mon Nov 07, 2011 5:41 am

Code: Select all

<!-- BEGIN announcements -->
Title: {announcements.TOPIC_TITLE}<br />
Post author: {announcements.POST_AUTHOR}<br />
Post date: {announcements.POST_DATE}<br />
Last post text: {announcements.POST_TEXT}<br />
Post link: {announcements.POST_LINK}
<!-- END announcements -->
I used the code that your how-to tutorial provided.
User avatar
TheGiftedApe
Greenhorn
Greenhorn
Posts: 16
Joined: Mon Nov 07, 2011 5:41 am

ok So i cleaned up the code a little bit and its now posting the author and the link. But it posts the author as "Guest" but if you click on the link it goes to the correct profile, any ideas? http://thegiftedape.com/xo/forum/tester.php, also how can i change it so the "Post Link" is actually a link rather than just a plain text url.

updated 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 : './';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);
include($phpbb_root_path . 'includes/bbcode.' . $phpEx);
include($phpbb_root_path . 'includes/functions_display.' . $phpEx);

// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup('viewforum');
/* create_where_clauses( int[] gen_id, String type )
* This function outputs an SQL WHERE statement for use when grabbing 
* posts and topics */

function create_where_clauses($gen_id, $type)
{
global $db, $auth;

    $size_gen_id = sizeof($gen_id);

        switch($type)
        {
            case 'forum':
                $type = 'forum_id';
                break;
            case 'topic':
                $type = 'topic_id';
                break;
            default:
                trigger_error('No type defined');
        }

    // Set $out_where to nothing, this will be used of the gen_id
    // size is empty, in other words "grab from anywhere" with
    // no restrictions
    $out_where = '';

    if( $size_gen_id > 0 )
    {
    // Get a list of all forums the user has permissions to read
    $auth_f_read = array_keys($auth->acl_getf('f_read', true));

        if( $type == 'topic_id' )
        {
            $sql     = 'SELECT topic_id FROM ' . TOPICS_TABLE . '
                        WHERE ' .  $db->sql_in_set('topic_id', $gen_id) . '
                        AND ' .  $db->sql_in_set('forum_id', $auth_f_read);

            $result     = $db->sql_query($sql);

                while( $row = $db->sql_fetchrow($result) )
                {
                        // Create an array with all acceptable topic ids
                        $topic_id_list[] = $row['topic_id'];
                }

            unset($gen_id);

            $gen_id = $topic_id_list;
            $size_gen_id = sizeof($gen_id);
        }

    $j = 0;    

        for( $i = 0; $i < $size_gen_id; $i++ )
        {
        $id_check = (int) $gen_id[$i];

            // If the type is topic, all checks have been made and the query can start to be built
            if( $type == 'topic_id' )
            {
                $out_where .= ($j == 0) ? 'WHERE ' . $type . ' = ' . $id_check . ' ' : 'OR ' . $type . ' = ' . $id_check . ' ';
            }

            // If the type is forum, do the check to make sure the user has read permissions
            else if( $type == 'forum_id' && $auth->acl_get('f_read', $id_check) )
            {
                $out_where .= ($j == 0) ? 'WHERE ' . $type . ' = ' . $id_check . ' ' : 'OR ' . $type . ' = ' . $id_check . ' ';
            }    

        $j++;
        }
    }

    if( $out_where == '' && $size_gen_id > 0 )
    {
        trigger_error('A list of topics/forums has not been created');
    }

    return $out_where;
}

$search_limit = 5;

    $forum_id = array(17);
    $forum_id_where = create_where_clauses($forum_id, 'forum');

    $topic_id = array();
    $topic_id_where = create_where_clauses($topic_id, 'topic');
$posts_ary = array(
        'SELECT'    => 'p.*, t.*',
    
        'FROM'      => array(
            POSTS_TABLE     => 'p',
        ),
    
        'LEFT_JOIN' => array(
            array(
                'FROM'  => array(TOPICS_TABLE => 't'),
                'ON'    => 't.topic_first_post_id = p.post_id'
            )
        ),
    
        'WHERE'     => str_replace( array('WHERE ', 'forum_id'), array('', 't.forum_id'), $forum_id_where) . '
                        AND 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();
?>
I didn't make any changes to the external body file.
User avatar
battye
Site Admin
Site Admin
Posts: 14391
Joined: Sun Jan 11, 2004 8:26 am
Location: Australia
Contact:

The reason why some weren't displaying was because in the template file it was POST_AUTHOR, POST_DATE, etc but in the original PHP file it was TOPIC_AUTHOR, etc. But it looks like you found that already :)

At a glance I'm not sure why it is displaying "Guest" if it has the correct profile id. Can you try this, find:

Code: Select all

$topic_title       = $posts_row['topic_title'];
After add

Code: Select all

echo 'OUTPUT: ' . $posts_row['username'] . ', ';
And run it, and let me know what you see?

As for fixing the link, in the template file find:

Code: Select all

Post link: {announcements.POST_LINK}
And replace it with:

Code: Select all

Post link: <a href="{announcements.POST_LINK}">Read this post</a>
CricketMX.com in 2022: Still the home of bat's, rat's and other farmyard animals!

"OK, life [as you chose to define it] repeats until there are no more lessons to be learned." - nrnoble (June 12, 2005)
"the new forum looks awesome, it's getting bigger & better" - p2p-sharing-rules (11 Jan, 2008)
"Looks like CMX is not only getting bigger...but, also getting better!!" - moongirl (14 Dec, 2007)
User avatar
TheGiftedApe
Greenhorn
Greenhorn
Posts: 16
Joined: Mon Nov 07, 2011 5:41 am

Well that definitely fixed the post link, however I am getting an error now.
OUTPUT: , OUTPUT: , OUTPUT: , OUTPUT: , OUTPUT: , [phpBB Debug] PHP Notice: in file /includes/functions.php on line 4505: Cannot modify header information - headers already sent by (output started at /tester.php:136)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4507: Cannot modify header information - headers already sent by (output started at /tester.php:136)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4508: Cannot modify header information - headers already sent by (output started at /tester.php:136)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4509: Cannot modify header information - headers already sent by (output started at /tester.php:136)


Here is the code from that area:

Code: Select all

 while( $posts_row = $db->sql_fetchrow($posts_result) )
      {
         $topic_title       = $posts_row['topic_title']; echo 'OUTPUT: ' . $posts_row['username'] . ', ';
         $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),
         ));
      }
line 136:

Code: Select all

 $topic_title       = $posts_row['topic_title']; echo 'OUTPUT: ' . $posts_row['username'] . ', ';
Full 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 : './';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);
include($phpbb_root_path . 'includes/bbcode.' . $phpEx);
include($phpbb_root_path . 'includes/functions_display.' . $phpEx);

// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup('viewforum');
/* create_where_clauses( int[] gen_id, String type )
* This function outputs an SQL WHERE statement for use when grabbing 
* posts and topics */

function create_where_clauses($gen_id, $type)
{
global $db, $auth;

    $size_gen_id = sizeof($gen_id);

        switch($type)
        {
            case 'forum':
                $type = 'forum_id';
                break;
            case 'topic':
                $type = 'topic_id';
                break;
            default:
                trigger_error('No type defined');
        }

    // Set $out_where to nothing, this will be used of the gen_id
    // size is empty, in other words "grab from anywhere" with
    // no restrictions
    $out_where = '';

    if( $size_gen_id > 0 )
    {
    // Get a list of all forums the user has permissions to read
    $auth_f_read = array_keys($auth->acl_getf('f_read', true));

        if( $type == 'topic_id' )
        {
            $sql     = 'SELECT topic_id FROM ' . TOPICS_TABLE . '
                        WHERE ' .  $db->sql_in_set('topic_id', $gen_id) . '
                        AND ' .  $db->sql_in_set('forum_id', $auth_f_read);

            $result     = $db->sql_query($sql);

                while( $row = $db->sql_fetchrow($result) )
                {
                        // Create an array with all acceptable topic ids
                        $topic_id_list[] = $row['topic_id'];
                }

            unset($gen_id);

            $gen_id = $topic_id_list;
            $size_gen_id = sizeof($gen_id);
        }

    $j = 0;    

        for( $i = 0; $i < $size_gen_id; $i++ )
        {
        $id_check = (int) $gen_id[$i];

            // If the type is topic, all checks have been made and the query can start to be built
            if( $type == 'topic_id' )
            {
                $out_where .= ($j == 0) ? 'WHERE ' . $type . ' = ' . $id_check . ' ' : 'OR ' . $type . ' = ' . $id_check . ' ';
            }

            // If the type is forum, do the check to make sure the user has read permissions
            else if( $type == 'forum_id' && $auth->acl_get('f_read', $id_check) )
            {
                $out_where .= ($j == 0) ? 'WHERE ' . $type . ' = ' . $id_check . ' ' : 'OR ' . $type . ' = ' . $id_check . ' ';
            }    

        $j++;
        }
    }

    if( $out_where == '' && $size_gen_id > 0 )
    {
        trigger_error('A list of topics/forums has not been created');
    }

    return $out_where;
}

$search_limit = 5;

    $forum_id = array(17);
    $forum_id_where = create_where_clauses($forum_id, 'forum');

    $topic_id = array();
    $topic_id_where = create_where_clauses($topic_id, 'topic');
$posts_ary = array(
        'SELECT'    => 'p.*, t.*',
    
        'FROM'      => array(
            POSTS_TABLE     => 'p',
        ),
    
        'LEFT_JOIN' => array(
            array(
                'FROM'  => array(TOPICS_TABLE => 't'),
                'ON'    => 't.topic_first_post_id = p.post_id'
            )
        ),
    
        'WHERE'     => str_replace( array('WHERE ', 'forum_id'), array('', 't.forum_id'), $forum_id_where) . '
                        AND 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']; echo 'OUTPUT: ' . $posts_row['username'] . ', ';
         $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();
?>
Also I am noticing that it posts the title on the same line as it posts the last link. However I'm going to assume that I can fix that later when I do the CSS. Once again thx for all your help it is very much appreciated, I'm sure it is frustrating helping out a newb, if you ever need some photoshop help lemme know :).
User avatar
TheGiftedApe
Greenhorn
Greenhorn
Posts: 16
Joined: Mon Nov 07, 2011 5:41 am

Ok So I have figured out a couple of things.

However I am having a few issues:

[s]1. The Post_author is still displaying my author as "Guest"[/s] EDIT: NVM FIXED THIS!! ♥
2. How can I stager the background color (dark grey/black) between the different lines(link/post/author/title etc)Such as I want the background color behind "Title" to be black and behind "author" to be dark gray, etc, to give each line a little more separation from each other.
3. [phpBB Debug] PHP Notice: in file /includes/session.php on line 1024: Cannot modify header information - headers already sent by (output started at /home/thegif15/public_html/xo/home.php:6)
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1024: Cannot modify header information - headers already sent by (output started at /home/thegif15/public_html/xo/home.php:6)
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1024: Cannot modify header information - headers already sent by (output started at /home/thegif15/public_html/xo/home.php:6)
you can view my progress here : http://www.thegiftedape.com/xo/home.php
This error shows up in some browsers.(firefox) Line 6 is where my css is, I didnt include session.php so I dont know why it is sending headers.

php portion 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.' . $phpEx);
include($phpbb_root_path . 'includes/functions_display.' . $phpEx);

// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup('viewforum');
/* create_where_clauses( int[] gen_id, String type )
* This function outputs an SQL WHERE statement for use when grabbing 
* posts and topics */

function create_where_clauses($gen_id, $type)
{
global $db, $auth;

    $size_gen_id = sizeof($gen_id);

        switch($type)
        {
            case 'forum':
                $type = 'forum_id';
                break;
            case 'topic':
                $type = 'topic_id';
                break;
            default:
                trigger_error('No type defined');
        }

    // Set $out_where to nothing, this will be used of the gen_id
    // size is empty, in other words "grab from anywhere" with
    // no restrictions
    $out_where = '';

    if( $size_gen_id > 0 )
    {
    // Get a list of all forums the user has permissions to read
    $auth_f_read = array_keys($auth->acl_getf('f_read', true));

        if( $type == 'topic_id' )
        {
            $sql     = 'SELECT topic_id FROM ' . TOPICS_TABLE . '
                        WHERE ' .  $db->sql_in_set('topic_id', $gen_id) . '
                        AND ' .  $db->sql_in_set('forum_id', $auth_f_read);

            $result     = $db->sql_query($sql);

                while( $row = $db->sql_fetchrow($result) )
                {
                        // Create an array with all acceptable topic ids
                        $topic_id_list[] = $row['topic_id'];
                }

            unset($gen_id);

            $gen_id = $topic_id_list;
            $size_gen_id = sizeof($gen_id);
        }

    $j = 0;    

        for( $i = 0; $i < $size_gen_id; $i++ )
        {
        $id_check = (int) $gen_id[$i];

            // If the type is topic, all checks have been made and the query can start to be built
            if( $type == 'topic_id' )
            {
                $out_where .= ($j == 0) ? 'WHERE ' . $type . ' = ' . $id_check . ' ' : 'OR ' . $type . ' = ' . $id_check . ' ';
            }

            // If the type is forum, do the check to make sure the user has read permissions
            else if( $type == 'forum_id' && $auth->acl_get('f_read', $id_check) )
            {
                $out_where .= ($j == 0) ? 'WHERE ' . $type . ' = ' . $id_check . ' ' : 'OR ' . $type . ' = ' . $id_check . ' ';
            }    

        $j++;
        }
    }

    if( $out_where == '' && $size_gen_id > 0 )
    {
        trigger_error('A list of topics/forums has not been created');
    }

    return $out_where;
}

$search_limit = 5;

    $forum_id = array(17);
    $forum_id_where = create_where_clauses($forum_id, 'forum');

    $topic_id = array();
    $topic_id_where = create_where_clauses($topic_id, 'topic');
$posts_ary = array(
        'SELECT'    => 'p.*, t.*',
    
        'FROM'      => array(
            POSTS_TABLE     => 'p',
        ),
    
        'LEFT_JOIN' => array(
            array(
                'FROM'  => array(TOPICS_TABLE => 't'),
                'ON'    => 't.topic_first_post_id = p.post_id'
            )
        ),
    
        'WHERE'     => str_replace( array('WHERE ', 'forum_id'), array('', 't.forum_id'), $forum_id_where) . '
                        AND 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);

        echo '<b><h2>' . $topic_title . '</h2></b>';
		echo 'Author: ' . $post_author . $posts_row['username'] . $topic_poster; ' , <br />';
		echo '<b>' . $topic_poster . '</b><br />';
		echo ''. $post_date . '<br />';
		echo $post_text  . '<br />';
		echo '<a href="' . $post_link . '">Read more</a><br /><br /><br /><br />';
		
      }
	
?>
Full site Code:

Code: Select all

<html>
<head>
<title>xoweb</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<!-- Save for Web Styles (xoweb.psd) -->
<style type="text/css">
<!--

#Table_01 {
	position: absolute;
	left: 50%;
	width: 1000px;
	margin-left: -500px;
	margin-top:0px;
	height:800px;
}

#xoweb-01 {
	position:absolute;
	left:0px;
	top:0px;
	width:1000px;
	height:63px;
}

#xoweb-02 {
	position:absolute;
	left:0px;
	top:63px;
	width:210px;
	height:81px;
}

#xoweb-03 {
	position:absolute;
	left:210px;
	top:63px;
	width:62px;
	height:33px;
}

#xoweb-04 {
	position:absolute;
	left:272px;
	top:63px;
	width:80px;
	height:33px;
}

#xoweb-05 {
	position:absolute;
	left:352px;
	top:63px;
	width:76px;
	height:33px;
}

#xoweb-06 {
	position:absolute;
	left:428px;
	top:63px;
	width:164px;
	height:81px;
}

#xoweb-07 {
	position:absolute;
	left:592px;
	top:63px;
	width:95px;
	height:33px;
}

#xoweb-08 {
	position:absolute;
	left:687px;
	top:63px;
	width:60px;
	height:33px;
}

#xoweb-09 {
	position:absolute;
	left:747px;
	top:63px;
	width:61px;
	height:33px;
}

#xoweb-10 {
	position:absolute;
	left:808px;
	top:63px;
	width:192px;
	height:81px;
}

#xoweb-11 {
	position:absolute;
	left:210px;
	top:96px;
	width:218px;
	height:48px;
}

#xoweb-12 {
	position:absolute;
	left:592px;
	top:96px;
	width:216px;
	height:48px;
}

#xoweb-13 {
	position:absolute;
	left:0px;
	top:144px;
	width:1000px;
	height:656px;
	background-image: url(images/xoweb_13.png);
	background-repeat:repeat-x;
}
body {
	background-color: #000;
	background-image: url(xowebbg.png);
	background-repeat: repeat-x;
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
}
a:link {
	color: #F00;
}
a:visited {
	color: #C00;
}
a:hover {
	color: #900;
}
a:active {
	color: #CCC;
}
body,td,th {
	font-family: Verdana, Geneva, sans-serif;
	color: #999;
}

-->

</style>
<!-- End Save for Web Styles -->
<script type="text/javascript">
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
</script>
</head>
<body style="background-color:#000000; margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px;" onLoad="MM_preloadImages('images/xoweb_over_03.png','images/xoweb_over_04.png','images/xoweb_over_05.png','images/xoweb_over_07.png','images/xoweb_over_08.png','images/xoweb_over_09.png')">
<center>
<div id="Table_01">
	<div id="xoweb-01">
		<img src="images/xoweb_01.png" width="1000" height="63" alt="">
	</div>
	<div id="xoweb-02">
		<img src="images/xoweb_02.png" width="210" height="81" alt="">
	</div>
	<div id="xoweb-03"> <a href="#" target="_self"><img src="images/xoweb_03.png" alt="" width="62" height="33" border="0" id="Image1" onMouseOver="MM_swapImage('Image1','','images/xoweb_over_03.png',1)" onMouseOut="MM_swapImgRestore()"></a>
	</div>
	<div id="xoweb-04"> <a href="#" target="_self"><img src="images/xoweb_04.png" alt="" width="80" height="33" border="0" id="Image2" onMouseOver="MM_swapImage('Image2','','images/xoweb_over_04.png',1)" onMouseOut="MM_swapImgRestore()"></a>
	</div>
	<div id="xoweb-05"> <a href="http://www.thegiftedape.com/xo/forum/" target="_new"><img src="images/xoweb_05.png" alt="" width="76" height="33" border="0" id="Image3" onMouseOver="MM_swapImage('Image3','','images/xoweb_over_05.png',1)" onMouseOut="MM_swapImgRestore()"></a>
	</div>
	<div id="xoweb-06">
		<img src="images/xoweb_06.png" width="164" height="81" alt="">
	</div>
	<div id="xoweb-07"> <a href="#" target="_self"><img src="images/xoweb_07.png" alt="" width="95" height="33" border="0" id="Image4" onMouseOver="MM_swapImage('Image4','','images/xoweb_over_07.png',1)" onMouseOut="MM_swapImgRestore()"></a>
	</div>
	<div id="xoweb-08"> <a href="#" target="_self"><img src="images/xoweb_08.png" alt="" width="60" height="33" border="0" id="Image5" onMouseOver="MM_swapImage('Image5','','images/xoweb_over_08.png',1)" onMouseOut="MM_swapImgRestore()"></a>
	</div>
	<div id="xoweb-09"> <a href="#" target="_self"><img src="images/xoweb_09.png" alt="" width="61" height="33" border="0" id="Image6" onMouseOver="MM_swapImage('Image6','','images/xoweb_over_09.png',1)" onMouseOut="MM_swapImgRestore()"></a>
	</div>
	<div id="xoweb-10">
		<img src="images/xoweb_10.png" width="192" height="81" alt="">
	</div>
	<div id="xoweb-11">
		<img src="images/xoweb_11.png" width="218" height="48" alt="">
	</div>
	<div id="xoweb-12">
		<img src="images/xoweb_12.png" width="216" height="48" alt="">
	</div>
	<div id="xoweb-13" align="left">
		<br><br><?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.' . $phpEx);
include($phpbb_root_path . 'includes/functions_display.' . $phpEx);

// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup('viewforum');
/* create_where_clauses( int[] gen_id, String type )
* This function outputs an SQL WHERE statement for use when grabbing 
* posts and topics */

function create_where_clauses($gen_id, $type)
{
global $db, $auth;

    $size_gen_id = sizeof($gen_id);

        switch($type)
        {
            case 'forum':
                $type = 'forum_id';
                break;
            case 'topic':
                $type = 'topic_id';
                break;
            default:
                trigger_error('No type defined');
        }

    // Set $out_where to nothing, this will be used of the gen_id
    // size is empty, in other words "grab from anywhere" with
    // no restrictions
    $out_where = '';

    if( $size_gen_id > 0 )
    {
    // Get a list of all forums the user has permissions to read
    $auth_f_read = array_keys($auth->acl_getf('f_read', true));

        if( $type == 'topic_id' )
        {
            $sql     = 'SELECT topic_id FROM ' . TOPICS_TABLE . '
                        WHERE ' .  $db->sql_in_set('topic_id', $gen_id) . '
                        AND ' .  $db->sql_in_set('forum_id', $auth_f_read);

            $result     = $db->sql_query($sql);

                while( $row = $db->sql_fetchrow($result) )
                {
                        // Create an array with all acceptable topic ids
                        $topic_id_list[] = $row['topic_id'];
                }

            unset($gen_id);

            $gen_id = $topic_id_list;
            $size_gen_id = sizeof($gen_id);
        }

    $j = 0;    

        for( $i = 0; $i < $size_gen_id; $i++ )
        {
        $id_check = (int) $gen_id[$i];

            // If the type is topic, all checks have been made and the query can start to be built
            if( $type == 'topic_id' )
            {
                $out_where .= ($j == 0) ? 'WHERE ' . $type . ' = ' . $id_check . ' ' : 'OR ' . $type . ' = ' . $id_check . ' ';
            }

            // If the type is forum, do the check to make sure the user has read permissions
            else if( $type == 'forum_id' && $auth->acl_get('f_read', $id_check) )
            {
                $out_where .= ($j == 0) ? 'WHERE ' . $type . ' = ' . $id_check . ' ' : 'OR ' . $type . ' = ' . $id_check . ' ';
            }    

        $j++;
        }
    }

    if( $out_where == '' && $size_gen_id > 0 )
    {
        trigger_error('A list of topics/forums has not been created');
    }

    return $out_where;
}

$search_limit = 5;

    $forum_id = array(17);
    $forum_id_where = create_where_clauses($forum_id, 'forum');

    $topic_id = array();
    $topic_id_where = create_where_clauses($topic_id, 'topic');
$posts_ary = array(
        'SELECT'    => 'p.*, t.*',
    
        'FROM'      => array(
            POSTS_TABLE     => 'p',
        ),
    
        'LEFT_JOIN' => array(
            array(
                'FROM'  => array(TOPICS_TABLE => 't'),
                'ON'    => 't.topic_first_post_id = p.post_id'
            )
        ),
    
        'WHERE'     => str_replace( array('WHERE ', 'forum_id'), array('', 't.forum_id'), $forum_id_where) . '
                        AND 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);

        echo '<b><h2>' . $topic_title . '</h2></b>';
		echo 'Author: ' . $post_author . $posts_row['username'] . $topic_poster; ' , <br />';
		echo '<b>' . $topic_poster . '</b><br />';
		echo ''. $post_date . '<br />';
		echo $post_text  . '<br />';
		echo '<a href="' . $post_link . '">Read more</a><br /><br /><br /><br />';
		
      }
	
?>
	</div>
</div>
</center>
</body>
User avatar
battye
Site Admin
Site Admin
Posts: 14391
Joined: Sun Jan 11, 2004 8:26 am
Location: Australia
Contact:

Sorry for the delay.

The debug errors are due to the "echo" statements. That was really only for debugging purposes, the best way to output everything is through the template file (ie. returning to using $template->assign_block_vars('announcements', array( ... etc). You can put your CSS in there too, that's not a problem. Just treat the .html file as a regular html file and not a phpBB template file. As such, where you used to have:

Code: Select all

page_header('External page');

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

    page_footer();
You would only want:

Code: Select all

$template->set_filenames(array(
        'body' => 'external_body.html'
    ));
As page_header and page_footer functions belong to phpBB and that is what creates the phpBB stylings. Of course, if you want that then keep them in :)
As for the rotating colours... off the top of my head I think the memberlist does this? So I think the best thing to do would be to look at memberlist_body.html and observe how the colours are rotated there. The key bit is this:

Code: Select all

<tr class="<!-- IF memberrow.S_ROW_COUNT is even -->bg1<!-- ELSE -->bg2<!-- ENDIF -->">
:)
CricketMX.com in 2022: Still the home of bat's, rat's and other farmyard animals!

"OK, life [as you chose to define it] repeats until there are no more lessons to be learned." - nrnoble (June 12, 2005)
"the new forum looks awesome, it's getting bigger & better" - p2p-sharing-rules (11 Jan, 2008)
"Looks like CMX is not only getting bigger...but, also getting better!!" - moongirl (14 Dec, 2007)
User avatar
TheGiftedApe
Greenhorn
Greenhorn
Posts: 16
Joined: Mon Nov 07, 2011 5:41 am

ok so I'm trying to incorporate these things but now nothing shows up at all, and the Error is still present.

[phpBB Debug] PHP Notice: in file /includes/session.php on line 1024: Cannot modify header information - headers already sent by (output started at /home/thegif15/public_html/xo/home2.php:6)
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1024: Cannot modify header information - headers already sent by (output started at /home/thegif15/public_html/xo/home2.php:6)
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1024: Cannot modify header information - headers already sent by (output started at /home/thegif15/public_html/xo/home2.php:6)

edit: I've also noticed that If I am logged into the forums, The error does not appear, but if I am not logged in to the forums it appears again.

http://www.xo-gaming.com/home2.php I am using home2.php to test things before I update it to http://www.xo-gaming.com/home.php

I am putting the php code, right in the Div on my website as I dont know anywhere else to put it or implement it, Should I be keeping the php seperate from my main site code and bringing it in a different way? I'm thinking I really dont need any css sent by phpbb, The rest of the site needs different css for the div's and such that I don't want phpbb controlling. I just need the text objects sent, as the forum on my site looks different than the news page looks. The full code looks like this, the php portion is at the bottom:

Code: Select all

<html>
<head>
<title>Team xO Gaming - Hug's N Kisses!!</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<!-- Save for Web Styles (xoweb.psd) -->
<style type="text/css">
<!--
#thing {
	position:relative;
	height:100%;
	width="1000";
	}

#Table_01 {
	position: absolute;
	left: 50%;
	width: 1000px;
	margin-left: -500px;
	margin-top:0px;
	height:800px;
}

#xoweb-01 {
	position:absolute;
	left:0px;
	top:0px;
	width:1000px;
	height:63px;
}

#xoweb-02 {
	position:absolute;
	left:0px;
	top:63px;
	width:210px;
	height:81px;
}

#xoweb-03 {
	position:absolute;
	left:210px;
	top:63px;
	width:62px;
	height:33px;
}

#xoweb-04 {
	position:absolute;
	left:272px;
	top:63px;
	width:80px;
	height:33px;
}

#xoweb-05 {
	position:absolute;
	left:352px;
	top:63px;
	width:76px;
	height:33px;
}

#xoweb-06 {
	position:absolute;
	left:428px;
	top:63px;
	width:164px;
	height:81px;
}

#xoweb-07 {
	position:absolute;
	left:592px;
	top:63px;
	width:95px;
	height:33px;
}

#xoweb-08 {
	position:absolute;
	left:687px;
	top:63px;
	width:60px;
	height:33px;
}

#xoweb-09 {
	position:absolute;
	left:747px;
	top:63px;
	width:61px;
	height:33px;
}

#xoweb-10 {
	position:absolute;
	left:808px;
	top:63px;
	width:192px;
	height:81px;
}

#xoweb-11 {
	position:absolute;
	left:210px;
	top:96px;
	width:218px;
	height:48px;
}

#xoweb-12 {
	position:absolute;
	left:592px;
	top:96px;
	width:216px;
	height:48px;
}

#xoweb-13 {
	position:absolute;
	left:0px;
	top:144px;
	width:1000px;
	height:656px;
	background-image: url(images/xoweb_13.png);
	background-repeat:repeat-x;
}
#foot {
	 {position: absolute; bottom: 0; left: 0; width: 1000px; height: 30px; background-color:#333;} 
	
	

}
body {
	background-color: #000;
	background-image: url(xowebbg.png);
	background-repeat: repeat-x;
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
}
a:link {
	color: #F00;
}
a:visited {
	color: #C00;
}
a:hover {
	color: #900;
}
a:active {
	color: #CCC;
}
body,td,th {
	font-family: Verdana, Geneva, sans-serif;
	color: #666;
	font-size: 12px;
}

-->

</style>
<!-- End Save for Web Styles -->
<script type="text/javascript">
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
</script>
</head>
<body style="background-color:#000000; margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px;" onLoad="MM_preloadImages('images/xoweb_over_03.png','images/xoweb_over_04.png','images/xoweb_over_05.png','images/xoweb_over_07.png','images/xoweb_over_08.png','images/xoweb_over_09.png')">
<center>
<div id="Table_01">
	<div id="xoweb-01">
		<img src="images/xoweb_01.png" width="1000" height="63" alt="">
	</div>
	<div id="xoweb-02">
		<img src="images/xoweb_02.png" width="210" height="81" alt="">
	</div>
	<div id="xoweb-03"> <a href="#news" target="_self"><img src="images/xoweb_03.png" alt="" width="62" height="33" border="0" id="Image1" onMouseOver="MM_swapImage('Image1','','images/xoweb_over_03.png',1)" onMouseOut="MM_swapImgRestore()"></a>
</div>
	<div id="xoweb-04"> <a href="roster.php" target="_self"><img src="images/xoweb_04.png" alt="" width="80" height="33" border="0" id="Image2" onMouseOver="MM_swapImage('Image2','','images/xoweb_over_04.png',1)" onMouseOut="MM_swapImgRestore()"></a>
</div>
	<div id="xoweb-05"> <a href="http://www.xo-gaming.com/forum/" target="_new"><img src="images/xoweb_05.png" alt="" width="76" height="33" border="0" id="Image3" onMouseOver="MM_swapImage('Image3','','images/xoweb_over_05.png',1)" onMouseOut="MM_swapImgRestore()"></a>
</div>
	<div id="xoweb-06">
		<img src="images/xoweb_06.png" width="164" height="81" alt="">
	</div>
	<div id="xoweb-07"> <a href="#" target="_self"><img src="images/xoweb_07.png" alt="" width="95" height="33" border="0" id="Image4" onMouseOver="MM_swapImage('Image4','','images/xoweb_over_07.png',1)" onMouseOut="MM_swapImgRestore()"></a>
	</div>
	<div id="xoweb-08"> <a href="#" target="_self"><img src="images/xoweb_08.png" alt="" width="60" height="33" border="0" id="Image5" onMouseOver="MM_swapImage('Image5','','images/xoweb_over_08.png',1)" onMouseOut="MM_swapImgRestore()"></a>
	</div>
	<div id="xoweb-09"> <a href="http://www.xo-gaming.com/forum/viewforum.php?f=8" target="_self"><img src="images/xoweb_09.png" alt="" width="61" height="33" border="0" id="Image6" onMouseOver="MM_swapImage('Image6','','images/xoweb_over_09.png',1)" onMouseOut="MM_swapImgRestore()"></a>
</div>
	<div id="xoweb-10">
		<img src="images/xoweb_10.png" width="192" height="81" alt="">
	</div>
	<div id="xoweb-11">
		<img src="images/xoweb_11.png" width="218" height="48" alt="">
	</div>
	<div id="xoweb-12">
		<img src="images/xoweb_12.png" width="216" height="48" alt="">
	</div>
<div id="xoweb-13" align="left" >
		<br><?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.' . $phpEx);
include($phpbb_root_path . 'includes/functions_display.' . $phpEx);

// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup('viewforum');
/* create_where_clauses( int[] gen_id, String type )
* This function outputs an SQL WHERE statement for use when grabbing 
* posts and topics */

function create_where_clauses($gen_id, $type)
{
global $db, $auth;

    $size_gen_id = sizeof($gen_id);

        switch($type)
        {
            case 'forum':
                $type = 'forum_id';
                break;
            case 'topic':
                $type = 'topic_id';
                break;
            default:
                trigger_error('No type defined');
        }

    // Set $out_where to nothing, this will be used of the gen_id
    // size is empty, in other words "grab from anywhere" with
    // no restrictions
    $out_where = '';

    if( $size_gen_id > 0 )
    {
    // Get a list of all forums the user has permissions to read
    $auth_f_read = array_keys($auth->acl_getf('f_read', true));

        if( $type == 'topic_id' )
        {
            $sql     = 'SELECT topic_id FROM ' . TOPICS_TABLE . '
                        WHERE ' .  $db->sql_in_set('topic_id', $gen_id) . '
                        AND ' .  $db->sql_in_set('forum_id', $auth_f_read);

            $result     = $db->sql_query($sql);

                while( $row = $db->sql_fetchrow($result) )
                {
                        // Create an array with all acceptable topic ids
                        $topic_id_list[] = $row['topic_id'];
                }

            unset($gen_id);

            $gen_id = $topic_id_list;
            $size_gen_id = sizeof($gen_id);
        }

    $j = 0;    

        for( $i = 0; $i < $size_gen_id; $i++ )
        {
        $id_check = (int) $gen_id[$i];

            // If the type is topic, all checks have been made and the query can start to be built
            if( $type == 'topic_id' )
            {
                $out_where .= ($j == 0) ? 'WHERE ' . $type . ' = ' . $id_check . ' ' : 'OR ' . $type . ' = ' . $id_check . ' ';
            }

            // If the type is forum, do the check to make sure the user has read permissions
            else if( $type == 'forum_id' && $auth->acl_get('f_read', $id_check) )
            {
                $out_where .= ($j == 0) ? 'WHERE ' . $type . ' = ' . $id_check . ' ' : 'OR ' . $type . ' = ' . $id_check . ' ';
            }    

        $j++;
        }
    }

    if( $out_where == '' && $size_gen_id > 0 )
    {
        trigger_error('A list of topics/forums has not been created');
    }

    return $out_where;
}

$search_limit = 5;

    $forum_id = array(17);
    $forum_id_where = create_where_clauses($forum_id, 'forum');

    $topic_id = array();
    $topic_id_where = create_where_clauses($topic_id, 'topic');
$posts_ary = array(
        'SELECT'    => 'p.*, t.*',
    
        'FROM'      => array(
            POSTS_TABLE     => 'p',
        ),
    
        'LEFT_JOIN' => array(
            array(
                'FROM'  => array(TOPICS_TABLE => 't'),
                'ON'    => 't.topic_first_post_id = p.post_id'
            )
        ),
    
        'WHERE'     => str_replace( array('WHERE ', 'forum_id'), array('', 't.forum_id'), $forum_id_where) . '
                        AND 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'];
         $topic_author       = get_username_string('full', $posts_row['topic_poster'], $posts_row['topic_first_poster_name'], $posts_row['topic_first_poster_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),
         ));
      }
	$template->set_filenames(array(
        'body' => 'external_body.html'
    ));
?>

<center>© 2011 <a href="http://www.xo-gaming.com/">Team xO,</a> <a href="http://www.thegiftedape.com">TheGiftedApe llc.</a></center></div>
</center>
</body>
</html>

Php only portion:

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.' . $phpEx);
include($phpbb_root_path . 'includes/functions_display.' . $phpEx);

// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup('viewforum');
/* create_where_clauses( int[] gen_id, String type )
* This function outputs an SQL WHERE statement for use when grabbing 
* posts and topics */

function create_where_clauses($gen_id, $type)
{
global $db, $auth;

    $size_gen_id = sizeof($gen_id);

        switch($type)
        {
            case 'forum':
                $type = 'forum_id';
                break;
            case 'topic':
                $type = 'topic_id';
                break;
            default:
                trigger_error('No type defined');
        }

    // Set $out_where to nothing, this will be used of the gen_id
    // size is empty, in other words "grab from anywhere" with
    // no restrictions
    $out_where = '';

    if( $size_gen_id > 0 )
    {
    // Get a list of all forums the user has permissions to read
    $auth_f_read = array_keys($auth->acl_getf('f_read', true));

        if( $type == 'topic_id' )
        {
            $sql     = 'SELECT topic_id FROM ' . TOPICS_TABLE . '
                        WHERE ' .  $db->sql_in_set('topic_id', $gen_id) . '
                        AND ' .  $db->sql_in_set('forum_id', $auth_f_read);

            $result     = $db->sql_query($sql);

                while( $row = $db->sql_fetchrow($result) )
                {
                        // Create an array with all acceptable topic ids
                        $topic_id_list[] = $row['topic_id'];
                }

            unset($gen_id);

            $gen_id = $topic_id_list;
            $size_gen_id = sizeof($gen_id);
        }

    $j = 0;    

        for( $i = 0; $i < $size_gen_id; $i++ )
        {
        $id_check = (int) $gen_id[$i];

            // If the type is topic, all checks have been made and the query can start to be built
            if( $type == 'topic_id' )
            {
                $out_where .= ($j == 0) ? 'WHERE ' . $type . ' = ' . $id_check . ' ' : 'OR ' . $type . ' = ' . $id_check . ' ';
            }

            // If the type is forum, do the check to make sure the user has read permissions
            else if( $type == 'forum_id' && $auth->acl_get('f_read', $id_check) )
            {
                $out_where .= ($j == 0) ? 'WHERE ' . $type . ' = ' . $id_check . ' ' : 'OR ' . $type . ' = ' . $id_check . ' ';
            }    

        $j++;
        }
    }

    if( $out_where == '' && $size_gen_id > 0 )
    {
        trigger_error('A list of topics/forums has not been created');
    }

    return $out_where;
}

$search_limit = 5;

    $forum_id = array(17);
    $forum_id_where = create_where_clauses($forum_id, 'forum');

    $topic_id = array();
    $topic_id_where = create_where_clauses($topic_id, 'topic');
$posts_ary = array(
        'SELECT'    => 'p.*, t.*',
    
        'FROM'      => array(
            POSTS_TABLE     => 'p',
        ),
    
        'LEFT_JOIN' => array(
            array(
                'FROM'  => array(TOPICS_TABLE => 't'),
                'ON'    => 't.topic_first_post_id = p.post_id'
            )
        ),
    
        'WHERE'     => str_replace( array('WHERE ', 'forum_id'), array('', 't.forum_id'), $forum_id_where) . '
                        AND 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'];
         $topic_author       = get_username_string('full', $posts_row['topic_poster'], $posts_row['topic_first_poster_name'], $posts_row['topic_first_poster_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),
         ));
      }
	$template->set_filenames(array(
        'body' => 'external_body.html'
    ));
?>
Get back to me whenever you can, I really appreciate everything I am learning a lot of things that will help me down the road that I can apply to other sites I work on, thx thx thx!


another edit: I have tried Placing all the css in a seperate stylesheet and linking it, and using ?php include=news.php and putting the php in the news.php file, still get the error. I've tried putting all the css on the external_body file and still error, AHHHHH!!! ;).

If I use this code: it displays(still with error)

Code: Select all

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

    page_footer();
If I just use this code, nothing displays at all except the error.

Code: Select all

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